This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author owenlin
Recipients owenlin
Date 2013-11-27.09:30:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1385544646.44.0.340337636792.issue19809@psf.upfronthosting.co.za>
In-reply-to
Content
If we call two subprocess.Popen simultaneously, the second one is blocked until the first one is finished. 

The attached file is a code snippet to reproduce this bug. I can reproduce the bug in version 2.7.3 and 2.7.6 very easily (in few seconds with the code). But it works fine on python3. 


Here is the backtrace of python
==========================================
#0  0x00007f0eba954d2d in read () at ../sysdeps/unix/syscall-template.S:82#1  0x00000000005d8d10 in posix_read (self=0x0, args=(5, 1048576)) at ../Modules/posixmodule.c:6628#2  0x0000000000486896 in PyCFunction_Call (func=<built-in function read>, arg=(5, 1048576), kw=0x0)    at ../Objects/methodobject.c:81#3  0x00000000005278e4 in ext_do_call (func=<built-in function read>, pp_stack=0x7fff1fc0ac80, flags=1, na=0, nk=0)    at ../Python/ceval.c:4331
#4  0x00000000005215cd in PyEval_EvalFrameEx (
    f=Frame 0x298f800, for file /usr/lib/python2.7/subprocess.py, line 478, in _eintr_retry_call (func=<built-in funct
ion read>, args=(5, 1048576)), throwflag=0) at ../Python/ceval.c:2705
#5  0x0000000000523c2e in PyEval_EvalCodeEx (co=0x294b880,     globals={'STDOUT': -2, '_has_poll': True, 'gc': <module at remote 0x29672d0>, 'check_call': <function at remote 0x29c4450>, 'mswindows': False, 'select': <module at remote 0x29676e0>, 'list2cmdline': <function at remote 0x29c45a0>, '__all__': ['Popen', 'PIPE', 'STDOUT', 'call', 'check_call', 'check_output', 'CalledProcessError'], 'errno': <module at remote 0x272d4d8>, '_demo_posix': <function at remote 0x29c4648>, '__package__': None, 'PIPE': -1, '_cleanup': <func
===================================

The fd 5 is actually a pipe. But I cannot find the other end of the pipe. A workaround is using lock around all the Popen()s.
History
Date User Action Args
2013-11-27 09:30:46owenlinsetrecipients: + owenlin
2013-11-27 09:30:46owenlinsetmessageid: <1385544646.44.0.340337636792.issue19809@psf.upfronthosting.co.za>
2013-11-27 09:30:46owenlinlinkissue19809 messages
2013-11-27 09:30:45owenlincreate