Message141939
When multiple threads create child processes simultaneously and redirect their stdout using subprocess.Popen, at least one thread will stuck on reading the stdout after its child process exited, until all other processes are also exited.
The test case reproduces the problem. It's always reproducible on my system (Python 3.1 on Windows 7 x64 / Python 3.2 on Windows 7 x86).
Here is my suspicion:
When Popen is called by two threads simultaneously, the latter child processes may be started before pipe handles for the former process are closed, causing the handles be incorrectly inherited by the latter process. So these handles can only be closed after all the two processes exit, and only after that, p.stdout.read* can detect EOF and return. |
|
Date |
User |
Action |
Args |
2011-08-12 03:20:24 | SAPikachu | set | recipients:
+ SAPikachu |
2011-08-12 03:20:24 | SAPikachu | set | messageid: <1313119224.46.0.971895609334.issue12739@psf.upfronthosting.co.za> |
2011-08-12 03:20:23 | SAPikachu | link | issue12739 messages |
2011-08-12 03:20:23 | SAPikachu | create | |
|