[ python-Bugs-1214859 ] subprocess auto-reaps children

SourceForge.net noreply at sourceforge.net
Mon Apr 10 18:04:38 CEST 2006


Bugs item #1214859, was opened at 2005-06-04 18:42
Message generated for change (Settings changed) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1214859&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: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mattias Engdegård (yorick)
Assigned to: Peter Ã
strand (astrand)
Summary: subprocess auto-reaps children

Initial Comment:
The subprocess module automatically reaps child processes, by 
maintaining a list of instances which is traversed each time a new 
Popen instance is created.

Apparently this was originally intended to avoid large number of 
zombie processes to accrete in the system if the programmer is 
lazy and does not wait for them properly, but it can cause problems 
when the programmer wants greater control. In particular, it's not 
possible to use the pid from a subprocess.Popen instance, since it 
may already have disappeared. For instance, it makes it difficult to 
use os.wait() to wait for several child processes at the same time.

The solution is simple: Add an option that disables the auto-reaper 
for a Popen instance. This makes everyone happy: existing code is 
unaffected, the programmer who wants to control her processes 
herself is allowed to do that, and the documentation is improved to 
help avoiding a nasty bug.

A patch was posted to the patch tracker as number 1187312. I 
suggest it for inclusion into the next release.


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-04-10 18:04

Message:
Logged In: YES 
user_id=21627

Thanks for the report. This is now fixed in r45234.

----------------------------------------------------------------------

Comment By: Andrew Waters (awaters)
Date: 2006-02-02 09:37

Message:
Logged In: YES 
user_id=1418249

May want to add a lock in order that auto reaping can 
happen in addition to the use of waitpid.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1214859&group_id=5470


More information about the Python-bugs-list mailing list