Open
Conversation
Sometimes a debugged process is already gone when python-ptrace performs
steps to terminate it. In that case we need to gracefully ignore any
`ESRCH` errors.
This issue was discovered when running network-testing[1] and resulted
in the following traceback.
Traceback (most recent call last):
File "./test-client-server", line 5, in <module>
main()
File "/home/pavlix/oss/network-testing/network_testing/client_server.py", line 55, in main
suite.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 431, in run
testcase.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 391, in run
scenario.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 172, in run
debugger.quit()
File "/home/pavlix/oss/network-testing/network_testing/debug.py", line 198, in quit
super(SyscallDebugger, self).quit()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/debugger.py", line 105, in quit
process.terminate()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 330, in terminate
self.waitExit()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 351, in waitExit
self.cont(signum)
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 717, in cont
ptrace_cont(self.pid, signum)
File "/usr/lib64/python3.4/site-packages/ptrace/binding/func.py", line 212, in ptrace_cont
ptrace(PTRACE_CONT, pid, 0, signum)
File "/usr/lib64/python3.4/site-packages/ptrace/binding/func.py", line 148, in ptrace
raise PtraceError(message, errno=errno, pid=pid)
ptrace.error.PtraceError: ptrace(cmd=7, pid=12894, 0, 133) error vstinner#3: No such process
[1]: https://github.com/pavlix/network-testing
Collaborator
Author
|
We are in no hurry, I just wanted to make sure it isn't forgotten during the switch to github. |
Owner
|
Your patch looks wrong: I see waitExit() in the traceback. The purpose of the function is to wait for the completion of the process, the exception should be handled here. |
Collaborator
Author
|
@Haypo Just to make sure, “handled here” means handled inside the |
Owner
|
The cont() exception should be catched in waitExit(). |
pavlix
added a commit
to crossdistro/network-testing
that referenced
this pull request
Oct 27, 2016
Traceback (most recent call last):
File "./test-client-server", line 5, in <module>
main()
File "/home/pavlix/oss/network-testing/network_testing/client_server.py", line 55, in main
suite.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 431, in run
testcase.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 391, in run
scenario.run()
File "/home/pavlix/oss/network-testing/network_testing/test_suite.py", line 172, in run
debugger.quit()
File "/home/pavlix/oss/network-testing/network_testing/debug.py", line 198, in quit
super(SyscallDebugger, self).quit()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/debugger.py", line 105, in quit
process.terminate()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 330, in terminate
self.waitExit()
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 351, in waitExit
self.cont(signum)
File "/usr/lib64/python3.4/site-packages/ptrace/debugger/process.py", line 717, in cont
ptrace_cont(self.pid, signum)
File "/usr/lib64/python3.4/site-packages/ptrace/binding/func.py", line 212, in ptrace_cont
ptrace(PTRACE_CONT, pid, 0, signum)
File "/usr/lib64/python3.4/site-packages/ptrace/binding/func.py", line 148, in ptrace
raise PtraceError(message, errno=errno, pid=pid)
ptrace.error.PtraceError: ptrace(cmd=7, pid=12894, 0, 133) error #3: No such process
Related: vstinner/python-ptrace#2
Owner
|
I don't maintain this project anymore, I'm looking for a new maintainer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch has been rejected but I'm still using it and this pull request will serve a new discussion. From the stacktrace below you can see that it's
debugger.quit()procedure we are talking about. Anything can happen during that procedure as we are killing a number of processes that depend on each other and do all sorts of stuff including quitting themselves before being killed by the debugger.In my opinion if the caller asks the debugger to quit, the debugger should be able to do that. Not catching an exception means that
debugger.quit()doesn't even finish its job and bad things can happen like left over processes and stuff like that. If special care is expected on the caller side,debugger.quit()documentation should probably be updated.Sometimes a debugged process is already gone when python-ptrace performs
steps to terminate it. In that case we need to gracefully ignore any
ESRCHerrors.This issue was discovered when running network-testing1 and resulted
in the following traceback.