Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; '"""': 0.07; 'assuming': 0.09; 'get(self,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'failure.': 0.16; 'indexerror:': 0.16; 'iterable,': 0.16; 'monitors': 0.16; 'months)': 0.16; 'seconds.': 0.16; 'subject:exception': 0.16; 'subject:program': 0.16; 'subject:skip:m 10': 0.16; 'targets': 0.16; 'underlying': 0.16; 'wing': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'index': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'library': 0.18; 'bit': 0.19; 'trying': 0.19; "python's": 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'module,': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'logging': 0.26; 'header:In-Reply-To:1': 0.27; 'raise': 0.29; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'easier': 0.31; '(maybe': 0.31; 'maintenance,': 0.31; 'occurs': 0.31; 'ray': 0.31; 'though.': 0.31; 'file': 0.32; 'run': 0.32; 'quite': 0.32; 'open': 0.33; 'running': 0.33; '(most': 0.33; 'mac': 0.33; 'skip:# 10': 0.33; 'subject:the': 0.34; 'basic': 0.35; 'connection': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'addresses,': 0.36; 'interact': 0.36; 'two': 0.37; 'list': 0.37; 'being': 0.38; 'loss': 0.38; 'checks': 0.38; 'handle': 0.38; 'issue': 0.38; 'recent': 0.39; '12,': 0.39; 'failures': 0.60; 'range': 0.61; 'simply': 0.61; 'real': 0.63; 'map': 0.64; 'different': 0.65; 'sunday': 0.68; 'country': 0.77; 'william': 0.81; 'harness': 0.84; 'launches': 0.84; 'oscar': 0.84; 'solvable': 0.84; 'subject:source': 0.84; 'nights': 0.91; 'hands': 0.96; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=hLxEM/Ir4lf8kc5qy6spRI1lPXJqSOSjfaNljHQi9aQ=; b=Q36kGA2aCE+luemS1VGcov4V2xw7NXKfv5lJEPRGgWh8FvNl4AvWuO8ru07ziCtLmV yK+dpd+IhScSsNgUbbARLYKT1gZJ4em++ZL7LdwSKia4EjA+t6qPVVJOMGEEyYZgBlqD wr/rWB+NxDXEIR8QdZcb8167bjgk2zj354Q3dF+cx6tFyNuOngGvrp/pqKTjvCYwRxho UAkP41XjxDwdKZSYe1UgxDF+SOCQ3zVqBwV+EaDIdUxc55UWz7ZLr6T7JBLaqR80wnGR j7gjKPCPCOlft2RHHon+tDbmTWScUX+ICVlGw4hvhST/6Lw/3m/yw7inGevHSUnSMSkr 0kgA== X-Received: by 10.58.161.6 with SMTP id xo6mr25665995veb.50.1366843068701; Wed, 24 Apr 2013 15:37:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <733559EE-CBDC-406A-8018-78CD41E2C445@mac.com> References: <733559EE-CBDC-406A-8018-78CD41E2C445@mac.com> From: Oscar Benjamin Date: Wed, 24 Apr 2013 23:37:28 +0100 Subject: Re: Finding the source of an exception in a python multiprocessing program To: William Ray Wing Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 69 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1366843071 news.xs4all.nl 15891 [2001:888:2000:d::a6]:42425 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44296 On 24 April 2013 20:25, William Ray Wing wrote: > I run a bit of python code that monitors my connection to the greater Int= ernet. It checks connectivity to the requested target IP addresses, loggin= g both successes and failures, once every 15 seconds. I see failures quite= regularly, predictably on Sunday nights after midnight when various networ= ks are undergoing maintenance. I'm trying to use python's multiprocessing = library to run multiple copies in parallel to check connectivity to differe= nt parts of the country (they in no way interact with each other). > > On rare occasions (maybe once every couple of months) I get the following= exception and traceback: > > Traceback (most recent call last): > File "./CM_Harness.py", line 12, in > Foo =3D pool.map(monitor, targets) # and hands off two targets > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/m= ultiprocessing/pool.py", line 227, in map > return self.map_async(func, iterable, chunksize).get() > File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/m= ultiprocessing/pool.py", line 528, in get > raise self._value > IndexError: list index out of range > > The code where the traceback occurs is: > > #!/usr/bin/env python > > """ Harness to call multiple parallel copies > of the basic monitor program > """ > > from multiprocessing import Pool > from Connection_Monitor import monitor > > targets =3D ["8.8.8.8", "www.ncsa.edu"] > pool =3D Pool(processes=3D2) # start 2 worker processes > Foo =3D pool.map(monitor, targets) # and hands off two targets > > > Line 12, in my code is simply the line that launches the underlying monit= or code. I'm assuming that the real error is occurring in the monitor prog= ram that is being launched, but I'm at a loss as to what to do to get a bet= ter handle on what's going wrong. Since, as I said, I see failures quite re= gularly, typically on Sunday nights after midnight when various networks ar= e undergoing maintenance, I don't _think_ the exception is being triggered = by that sort of failure. > > When I look at the pool module, the error is occurring in get(self, timeo= ut=3DNone) on the line after the final else: > > def get(self, timeout=3DNone): > self.wait(timeout) > if not self._ready: > raise TimeoutError > if self._success: > return self._value > else: > raise self._value > > > Python v 2.7.3, from Python.org, running on Mac OS-X 10.8.3 This looks to me like a bug in multiprocessing but I'm not very experienced with it. Perhaps it would be good to open an issue on the tracker. It might not be solvable without an easier way of reproducing it though. Oscar