-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When sending "poweroff" command, process hangs #14
Comments
Hello! A few questions that might help me understand the problem a bit better. What's the actual stack trace that you get when You mentioned the process gets stuck in What happens if you execute a different command (e.g. What happens if you only run a different command (e.g. |
Thanks for the quick response. Without the try..catch..else block: ...
with shell:
result = shell.run(cmd)
log.info(result.output)
return result.output The following exception is raised: Mon, 31 Mar 2014 10:40:25 - INFO - START: Iteration 0
Mon, 31 Mar 2014 10:40:25 - INFO - Getting systemd-analyze
Mon, 31 Mar 2014 10:40:30 - INFO - Startup finished in 3.825s (kernel) + 16.107s (userspace) = 19.932s
Mon, 31 Mar 2014 10:40:30 - INFO - Powering off
Traceback (most recent call last):
File "test.py", line 79, in <module>
run_command(["sudo", "poweroff"], host)
File "test.py", line 43, in run_command
result = shell.run(cmd)
File "/home/amit/projects/zxi-boot-test/local/lib/python2.7/site-packages/spur/ssh.py", line 71, in run
return self.spawn(*args, **kwargs).wait_for_result()
File "/home/amit/projects/zxi-boot-test/local/lib/python2.7/site-packages/spur/ssh.py", line 280, in wait_for_result
self._result = self._generate_result()
File "/home/amit/projects/zxi-boot-test/local/lib/python2.7/site-packages/spur/ssh.py", line 292, in _generate_result
stderr_output
File "/home/amit/projects/zxi-boot-test/local/lib/python2.7/site-packages/spur/results.py", line 9, in result
raise result.to_error()
spur.results.RunProcessError: return code: -1
output:
stderr output: I do have a call before powering off (as shown in the above log output) and this basically just calls systemd-analyze and gets the boot time. This command always succeeds. |
If you're expecting an error, then using Given that turning the machine off is likely to break the connection, I'd suggest you'd be better off using If you could provide a stack trace of where the command gets stuck (even if using |
Thanks. I will try those suggestions out. Also, how do I provide the stack trace when the command is stuck? Do I attach to the process using pdb/gdb? |
Yup, pdb/gdb is probably your best bet. |
Process is currently hung, using gdb to attach to the process: Note: this is with shell.run(cmd, allow_error=True)
The python debug symbols are there but not sure what the system supplied DSO at 0x7fff30d24000 means. I will leave the process at this state, so if you need me to run any other debugging commands I can run them. |
Hmm, not sure why |
Oh, and I forgot to ask: did using |
With allow_error=True, I did not need the try catch block and the test ran On Mon, Mar 31, 2014 at 2:49 PM, Michael Williamson <
|
Did you have any luck finding out where the program was hanging? |
Haven't tried it out since our last conversation. However, working on On Fri, Apr 18, 2014 at 6:56 AM, Michael Williamson
|
Running gdb on a virtualenv script doesn't give much info. So ran it Looks like it is locking. (gdb) py-bt
On Fri, Apr 18, 2014 at 06:56:41AM -0700, Michael Williamson wrote:
|
Could you get a backtrace for the other threads as well? It looks like it's stuck waiting for the process to terminate, but I'm not quite sure why it's doing that if you're using |
Yes, I'm calling wait_for_result(). I have the following function: def run_command(cmd, host):
I call run_command with various commands and then finally with a However, I can create a different function just for the poweroff without On Wed, Apr 30, 2014 at 03:14:16AM -0700, Michael Williamson wrote:
|
That would seem to me to be the most appropriate method. Using Backtraces for the other threads would still be handy in working out what the issue though. |
(gdb) info threads
Is this the backtrace you were talking about? I will leave the process |
|
Output of 't a a py-bt': |
Thanks! I'll take a look when I get a chance, but hopefully just using |
Thanks will do that. Also, you might want to save the bt, i think the On Wed, Apr 30, 2014 at 10:32 AM, Michael Williamson <
|
Thanks for letting me know, I've slapped it in a gist: |
Thanks! On Wed, Apr 30, 2014 at 10:37 AM, Michael Williamson <
|
I use the following code to send a poweroff command to a remote machine. I catch the resulting exception otherwise I get RunProcessError. I am trying to test poweroff + wake on lan on a unit repeatedly so I run this in a loop about 100-200 times. I usually the process hang around the 30th iteration:
The text was updated successfully, but these errors were encountered: