Nathaniel Smith <n...@pobox.com> added the comment:
> 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38630> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com