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: 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 Subject: Re: subprocess.Popen zombie Date: Wed, 20 May 2015 17:44:50 +0100 References: <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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 20/05/2015 16:42, Alain Ketterlin wrote: > Robin Becker 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