[issue42558] waitpid/waitid race caused by change to Popen.send_signal in Python 3.9
STINNER Victor
report at bugs.python.org
Fri Dec 4 06:08:55 EST 2020
STINNER Victor <vstinner at python.org> added the comment:
The script fails with "ChildProcessError: [Errno 10] No child processes" on line:
> os.waitpid(child.pid, 0)
The line before, you call child.kill() which sends SIGKILL signal to the process. So it's likely that the process will complete (killed by SIGKILL) soon.
I don't think that it's a good idea to attempt reading the process status directly (by calling os.waitpid), since subprocess already tracks the process status.
There is the public child.poll() API which calls os.waitpid(child.pid, 0) in a safe way for you. Why not using this API?
IMO this issue is not a bug.
Note: Python 3.8 behaves differently, but it doesn't mean that calling directly os.waitpid() was a good idea in Python 3.8 and older ;-)
----------
nosy: +gregory.p.smith, vstinner
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42558>
_______________________________________
More information about the Python-bugs-list
mailing list