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 oconnor663
Recipients SpecLad, giampaolo.rodola, njs, oconnor663, vstinner
Date 2020-12-03.06:12:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606975958.04.0.733462373776.issue38630@roundup.psfhosted.org>
In-reply-to
Content
This change caused a crash in the Duct library in Python 3.9. Duct uses the waitid(NOWAIT) strategy that Nathaniel Smith has described in this thread. With this change, the child process is reaped by kill() in a spot we didn't expect, and a subsequent call to os.waitid() raises a ChildProcessError. This is a race condition that only triggers if the child happens to exit before kill() is called.

I just pushed https://github.com/oconnor663/duct.py/commit/5dfae70cc9481051c5e53da0c48d9efa8ff71507 to work around this, which I'll release shortly as Duct version 0.6.4.

Broadly speaking, this change could break any program that uses Popen.kill() together with os.waitpid() or os.waitid(). Checking Popen.returncode before calling the os functions is a good workaround for the single-threaded case, but it doesn't fix the multithreaded case. Duct is going to avoid calling Popen.kill() entirely. There are some longer comments about race conditions in that commit I linked.

I don't feel strongly one way the other about keeping this new behavior, but we should probably document it clearly in Popen.send_signal() and all of its callers that these functions might reap the child.
History
Date User Action Args
2020-12-03 06:12:38oconnor663setrecipients: + oconnor663, vstinner, giampaolo.rodola, njs, SpecLad
2020-12-03 06:12:38oconnor663setmessageid: <1606975958.04.0.733462373776.issue38630@roundup.psfhosted.org>
2020-12-03 06:12:38oconnor663linkissue38630 messages
2020-12-03 06:12:37oconnor663create