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 njs
Recipients giampaolo.rodola, njs, vstinner
Date 2019-11-06.00:43:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Hmm, you know, on further thought, it is actually possible to close this race for real, without pidfd.

What you do is split 'wait' into two parts: first it waits for me process to become reapable without actually reaping it. On Linux you can do this with waitid+WNOWAIT. On kqueue platforms you can do it with kqueue.

Then, you take a lock, and use it to atomically call waitpid/waitid to reap the process + update self.returncode to record that you've done so.

In send_signal, we use the same lock to atomically check whether the process has been reaped, and then send the signal if it hasn't.

That doesn't fix your test, but it does fix the race condition: as long as users only interact with the process through the Popen API, it guarantees that send_signal will never rather the wrong process.
Date User Action Args
2019-11-06 00:43:48njssetrecipients: + njs, vstinner, giampaolo.rodola
2019-11-06 00:43:48njssetmessageid: <>
2019-11-06 00:43:48njslinkissue38630 messages
2019-11-06 00:43:47njscreate