Message356085
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:48 | njs | set | recipients:
+ njs, vstinner, giampaolo.rodola |
2019-11-06 00:43:48 | njs | set | messageid: <1573001028.13.0.28225085185.issue38630@roundup.psfhosted.org> |
2019-11-06 00:43:48 | njs | link | issue38630 messages |
2019-11-06 00:43:47 | njs | create | |
|