Bugs item #1753891, was opened at 2007-07-13 20:06 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1753891&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Threads Group: Python 2.4 Status: Open Resolution: None Priority: 5 Private: No Submitted By: slowfood (slowfood) Assigned to: Nobody/Anonymous (nobody) Summary: subprocess raising "No Child Process" OSError Initial Comment: The program below demostrates a "No Child Process" OSError on a multi-cpu systems. This is extracted from a large system where we are trying to manage many sub-processes, some of which end up having little/no real work to do so they return very fast, here emulated by having the sub-process be an invocation of: Executable="/bin/sleep 0" Seems like some race condition, since if you make the child process take some time (sleep 0.1) the frequency of errors decreeses. Error only shows up when there are more threads than have real CPU's by at least a factor of two, on dual core machines up NumThreads to 18 to get the failures. Same error on both Python 2.4.3 with: Linux 2.6.18-gentoo-r3 Gentoo and Python 2.4.4 with: Linux 2.6.20-gentoo-r8 Any help appreciated - = = = ===== Start code example =========== % python subprocess_noChildErr.py Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib64/python2.4/threading.py", line 442, in __bootstrap self.run() File "testCaseA.py", line 14, in run subprocess.call(Executable.split()) File "/usr/lib64/python2.4/subprocess.py", line 413, in call return Popen(*args, **kwargs).wait() File "/usr/lib64/python2.4/subprocess.py", line 1007, in wait pid, sts = os.waitpid(self.pid, 0) OSError: [Errno 10] No child processes Test finished % cat subprocess_noChildErr.py import subprocess, threading # Params Executable="/bin/sleep 0" NumThreads = 18 NumIterations = 10 class TestClass(threading.Thread): def __init__(self, threadNum): self.threadNum = threadNum threading.Thread.__init__(self) def run(self): for i in range(NumIterations): subprocess.call(Executable.split()) def test(): allThreads = [] for i in range(NumThreads): allThreads.append(TestClass(i)) for i in range(NumThreads): allThreads[i].start() for i in range(NumThreads): allThreads[i].join() print "Test finished" if __name__ == '__main__': test() % python -V Python 2.4.4 % uname -a Linux 2.6.20-gentoo-r8 #2 SMP PREEMPT Sun Jul 1 13:22:56 PDT 2007 x86_64 Dual-Core AMD Opteron(tm) Processor 2212 AuthenticAMD GNU/Linux % % date Fri Jul 13 19:26:44 PDT 2007 % = = = ===== End code example =========== ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1753891&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com