os.wait() losing child?

Jason Zheng Xin.Zheng at jpl.nasa.gov
Thu Jul 12 12:27:18 EDT 2007


Hrvoje Niksic wrote:
>> greg wrote:
> 
> Actually, it's not that bad.  _cleanup only polls the instances that
> are no longer referenced by user code, but still running.  If you hang
> on to Popen instances, they won't be added to _active, and __init__
> won't reap them (_active is only populated from Popen.__del__).
> 

Perhaps that's the difference between Python 2.4 and 2.5. In 2.4, 
Popen's __init__ always appends self to _active:

def __init__(...):
   _cleanup()
   ...
   self._execute_child(...)
   ...
   _active.append(self)


> This version is a trivial modification of your code to that effect.
> Does it work for you?
> 

Nope it still doesn't work. I'm running python 2.4.4, tho.

$ python test.py
Starting child process 0 (26497)
Starting child process 1 (26498)
Starting child process 2 (26499)
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated, restarting
Child Process 2 terminated.
Traceback (most recent call last):
   File "test.py", line 15, in ?
     pid, ignored = os.wait()
OSError: [Errno 10] No child processes



More information about the Python-list mailing list