Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90969

Re: subprocess.Popen zombie

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'none:': 0.07; 'subject:skip:s 10': 0.07; 'suppose': 0.07; 'alain': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'worse': 0.09; '__del__': 0.16; 'dislike': 0.16; 'loop.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'somehow.': 0.16; 'thread,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'seems': 0.21; 'appears': 0.22; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'convenient': 0.24; 'cc:2**0': 0.24; 'skip:_ 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'record': 0.27; 'code': 0.31; 'really,': 0.31; 'routine': 0.31; 'schemes': 0.31; 'writes:': 0.31; 'yes.': 0.31; 'yourself.': 0.31; 'probably': 0.32; 'another': 0.32; 'trouble': 0.34; "can't": 0.35; 'created': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'really': 0.36; 'instances': 0.36; 'doing': 0.36; 'method': 0.36; 'should': 0.36; 'list': 0.37; 'needed': 0.38; 'to:addr :python-list': 0.38; 'does': 0.39; 'skip:. 10': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'around.': 0.60; 'gone': 0.61; 'received:109': 0.72; 'records': 0.73; 'recognition': 0.84; 'routines': 0.84; 'mean.': 0.91; 'notion': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robin Becker <robin@reportlab.com>
Subject Re: subprocess.Popen zombie
Date Wed, 20 May 2015 17:44:50 +0100
References <mailman.170.1432127818.17265.python-list@python.org> <87bnhfqmr4.fsf@universite-de-strasbourg.fr.invalid>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Cc Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid>
X-Gmane-NNTP-Posting-Host 109.174.168.73
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <87bnhfqmr4.fsf@universite-de-strasbourg.fr.invalid>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.177.1432140299.17265.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432140299 news.xs4all.nl 2924 [2001:888:2000:d::a6]:44109
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90969

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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