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 SpecLad, giampaolo.rodola, njs, vstinner
Date 2019-12-09.22:04:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
>             revalidate pid licenses

It means autocorrect mangled the text... I don't remember what word that's supposed to be, but basically I meant "revalidate the pid hasn't been reaped"

> Wouldn't it be sufficient to add
> if self.returncode is not None:
>     return self.returncode
> at the top of poll()?

No, the race condition is:

1. Process exits
[some time passes]
2. Thread 1 and Thread 2 both call poll() simultaneously
3. Thread 1 and Thread 2 both see that the process hasn't been reaped
4. Thread 1 attempts to take the blocking_wait_lock, to make sure no-one is blocked in wait(). It succeeds.
5. Thread 2 attempts to take the blocking_wait_lock, and it fails (because Thread 1 already has it). Thread 2's poll() returns saying that the process hasn't exited yet (which is wrong!)
6. Thread 1 calls waitpid(..., WNOHANG) and reaps the process, then releases the lock.

So adding a check at the top (= step 3) doesn't help. The problem is in steps 4/5.
Date User Action Args
2019-12-09 22:04:42njssetrecipients: + njs, vstinner, giampaolo.rodola, SpecLad
2019-12-09 22:04:42njssetmessageid: <>
2019-12-09 22:04:42njslinkissue38630 messages
2019-12-09 22:04:42njscreate