Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90969
| From | Robin Becker <robin@reportlab.com> |
|---|---|
| Subject | Re: subprocess.Popen zombie |
| Date | 2015-05-20 17:44 +0100 |
| References | <mailman.170.1432127818.17265.python-list@python.org> <87bnhfqmr4.fsf@universite-de-strasbourg.fr.invalid> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.177.1432140299.17265.python-list@python.org> (permalink) |
On 20/05/2015 16:42, Alain Ketterlin wrote:
> Robin Becker <robin@reportlab.com> writes:
.............
>> The code I used to use with os.spawnl was even worse in leaving
>> zombies around.
>
> For the same reason (os.wait() and os.waitpid() let you ... wait for
> child-processes).
>
>> I suppose I needed to keep a record of all the pid's and wait on them
>> at some convenient time.
>
> Yes.
>
>> The subprocess version appears to be doing that for me somehow.
>
> Not sure what you mean. You have to do the bookkeeping yourself.
It seems there is some notion of book keeping in subprocess.py
Popen instances have a __del__ method which records un-norwegian live instances
in a module global _active
if self.returncode is None and _active is not None:
# Child is still running, keep us alive until we can wait on it.
_active.append(self)
when another Popen is created there's a call to _cleanup which processes that
list and reaps those that can be raptured.
>
> (But, does beep really take so much time that you can't just call() it?)
>
not really, it's just normal to keep event routines short; the routine which
beeps is after detection of the cat's entrance into the house and various
recognition schemes have pronounced intruder :)
Probably should all have gone into a separate thread, but I dislike threaded
code and I would probably get into trouble with the PyQT event loop.
> -- Alain.
>
--
Robin Becker
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
subprocess.Popen zombie Robin Becker <robin@reportlab.com> - 2015-05-20 14:16 +0100
Re: subprocess.Popen zombie Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 16:48 +0200
Re: subprocess.Popen zombie Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2015-05-20 17:42 +0200
Re: subprocess.Popen zombie Robin Becker <robin@reportlab.com> - 2015-05-20 17:44 +0100
Re: subprocess.Popen zombie Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2015-05-21 08:35 +0200
Re: subprocess.Popen zombie Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-21 08:13 -0600
csiph-web