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.

classification
Title: subprocess.Popen.wait fails sporadically with threads
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: abo, georg.brandl, gjb1002
Priority: normal Keywords:

Created on 2007-07-16 09:26 by gjb1002, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
subprocess_bug.py gjb1002, 2007-07-16 09:26 Test program to reproduce problem (sometimes)
Messages (4)
msg32515 - (view) Author: Geoffrey Bache (gjb1002) Date: 2007-07-16 09:26
When several threads are using the subprocess module I occasionally get stack traces that look like 

    out, err = process.communicate()
  File "/usr/lib/python2.4/subprocess.py", line 1083, in communicate
    self.wait()
  File "/usr/lib/python2.4/subprocess.py", line 1007, in wait
    pid, sts = os.waitpid(self.pid, 0)
OSError: [Errno 10] No child processes

See the fixed bug at 

https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1183780&group_id=5470

The problem I am observing seems to match the one described there in the "related modules" part. After discovering that bug, I downloaded the test program attached to it and discovered that I got the errors described from time to time. I am using Python 2.4.3 on Red Hat EL4 and Python 2.4.4 on Red Hat EL3, and both have this error.

I reattach my tweaked version of that test program. The only basic difference is that testing subprocess is the default option and the default number of threads increased to 50 as this seemed to mean it occurred more often. I have reproduced the original popen2 problem once on Python 2.4.4 but it's much more infrequent, and not a problem in practice for me. 

See the comment at the top of that script for details of expected behaviour etc.
msg32516 - (view) Author: Geoffrey Bache (gjb1002) Date: 2007-07-16 09:32
Hmm, seems someone else reported this during the weekend. Looks rather similar to bug 1753891...

I let someone else mark as duplicate if they want. Can't harm to have two different test programs for an indeterministic problem :)
msg32517 - (view) Author: Donovan Baarda (abo) * Date: 2007-08-03 19:37
Bugs 1754642 and 1753891 both look like duplicates of bug 1731717 to me. I suggest marking them both as dups of 1731717 because that one has info on the race-condition that causes this and discussions on how to fix it.
msg32518 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-04 07:24
Duplicate of #1731717.
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45207
2007-07-16 09:26:01gjb1002create