Author SAPikachu
Recipients SAPikachu
Date 2011-08-12.03:20:22
SpamBayes Score 1.10854e-05
Marked as misclassified No
Message-id <1313119224.46.0.971895609334.issue12739@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-08-12 03:20:24SAPikachusetrecipients: + SAPikachu
2011-08-12 03:20:24SAPikachusetmessageid: <1313119224.46.0.971895609334.issue12739@psf.upfronthosting.co.za>
2011-08-12 03:20:23SAPikachulinkissue12739 messages
2011-08-12 03:20:23SAPikachucreate