This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2017-08-10.09:20:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1502356853.63.0.0769606130984.issue31173@psf.upfronthosting.co.za>
In-reply-to
Content
The test_child_terminated_in_stopped_state() test creates a child process which calls ptrace(PTRACE_ME, 0, 0) and then crashs using SIGSEGV. The problem is that even if we read the exit status using os.waitpid() through subprocess, the process remains alive in the "t (tracing stop)" state.

I would prefer to not use ptrace() is an unit test since this API is very low-level and it's hard to use it correctly.

I suggest to either remove the functional test, or to rewrite it as an unit test using mocks to test bpo-29335 without ptrace().

haypo@selma$ ./python -m test -m test_child_terminated_in_stopped_state -F test_subprocess
Run tests sequentially
0:00:00 load avg: 0.95 [  1] test_subprocess
0:00:00 load avg: 0.95 [  2] test_subprocess
0:00:01 load avg: 0.96 [  3] test_subprocess
0:00:01 load avg: 0.96 [  4] test_subprocess
0:00:02 load avg: 0.96 [  5] test_subprocess
0:00:03 load avg: 0.96 [  6] test_subprocess
0:00:03 load avg: 0.96 [  7] test_subprocess
0:00:04 load avg: 0.96 [  8] test_subprocess
0:00:05 load avg: 0.96 [  9] test_subprocess
0:00:05 load avg: 0.96 [ 10] test_subprocess
^Z
[1]+  Stoppé                 ./python -m test -m test_child_terminated_in_stopped_state -F test_subprocess

haypo@selma$ ps
  PID TTY          TIME CMD
30359 pts/0    00:00:00 bash
31882 pts/0    00:00:00 python
31885 pts/0    00:00:00 python
31888 pts/0    00:00:00 python
31892 pts/0    00:00:00 python
31895 pts/0    00:00:00 python
31898 pts/0    00:00:00 python
31901 pts/0    00:00:00 python
31904 pts/0    00:00:00 python
31907 pts/0    00:00:00 python
31910 pts/0    00:00:00 python
31912 pts/0    00:00:00 python
31920 pts/0    00:00:00 ps

haypo@selma$ grep Stat /proc/31885/status
State:	t (tracing stop)
History
Date User Action Args
2017-08-10 09:20:53vstinnersetrecipients: + vstinner
2017-08-10 09:20:53vstinnersetmessageid: <1502356853.63.0.0769606130984.issue31173@psf.upfronthosting.co.za>
2017-08-10 09:20:53vstinnerlinkissue31173 messages
2017-08-10 09:20:53vstinnercreate