Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subprocess auto-reaps children #42052

Closed
yorick mannequin opened this issue Jun 4, 2005 · 3 comments
Closed

subprocess auto-reaps children #42052

yorick mannequin opened this issue Jun 4, 2005 · 3 comments

Comments

@yorick
Copy link
Mannequin

yorick mannequin commented Jun 4, 2005

BPO 1214859
Nosy @loewis

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2006-04-10.16:04:35.000>
created_at = <Date 2005-06-04.16:42:25.000>
labels = []
title = 'subprocess auto-reaps children'
updated_at = <Date 2006-04-10.16:04:35.000>
user = 'https://bugs.python.org/yorick'

bugs.python.org fields:

activity = <Date 2006-04-10.16:04:35.000>
actor = 'loewis'
assignee = 'astrand'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2005-06-04.16:42:25.000>
creator = 'yorick'
dependencies = []
files = []
hgrepos = []
issue_num = 1214859
keywords = []
message_count = 3.0
messages = ['25486', '25487', '25488']
nosy_count = 4.0
nosy_names = ['loewis', 'astrand', 'yorick', 'awaters']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1214859'
versions = []

@yorick
Copy link
Mannequin Author

yorick mannequin commented Jun 4, 2005

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.

@yorick yorick mannequin closed this as completed Jun 4, 2005
@yorick yorick mannequin assigned astrand Jun 4, 2005
@yorick yorick mannequin closed this as completed Jun 4, 2005
@yorick yorick mannequin assigned astrand Jun 4, 2005
@awaters
Copy link
Mannequin

awaters mannequin commented Feb 2, 2006

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.

@loewis
Copy link
Mannequin

loewis mannequin commented Apr 10, 2006

Logged In: YES
user_id=21627

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

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants