Adam Meily added the comment:

Attached is a test Python script that you can run to see the race condition in 
action. There are two Python scripts: pipe.py and reader.py.

 - pipe.py: make two subprocess.Popen() calls from two different threads.

 - reader.py: (its content is in the bottom comments of pipe.py, so move it to 
a separate file): reads lines from stdin and exits

Basically, pipe.py creates a pipe between "echo Hello World!" and "python 
reader.py".

You'll see that pipe.py will hang until ctrl+c is entered, even though the 
first subprocess in the pipe, reader.py, exits. Uncommenting the time.sleep() 
call will cause the first subprocess.Popen() time to properly close the 
inheritable handles before the second subprocess.Popen() call is made in the 
other thread, thus the inheritable handles are leaked.

----------
Added file: http://bugs.python.org/file40220/pipe.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24909>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to