New submission from Joe Hu <sapika...@gmail.com>: 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. ---------- components: Library (Lib), Windows files: python-subprocess-bug-test-case.py messages: 141939 nosy: SAPikachu priority: normal severity: normal status: open title: read stuck with multithreading and simultaneous subprocess.Popen type: behavior versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file22885/python-subprocess-bug-test-case.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12739> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com