Message358147
> 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:42 | njs | set | recipients:
+ njs, vstinner, giampaolo.rodola, SpecLad |
2019-12-09 22:04:42 | njs | set | messageid: <1575929082.29.0.239567961278.issue38630@roundup.psfhosted.org> |
2019-12-09 22:04:42 | njs | link | issue38630 messages |
2019-12-09 22:04:42 | njs | create | |
|