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


Groups > comp.lang.python > #44289

Finding the source of an exception in a python multiprocessing program

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <wrw@mac.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; '"""': 0.07; 'suggestions,': 0.07; 'assuming': 0.09; 'get(self,': 0.09; 'python': 0.11; 'def': 0.12; 'failure.': 0.16; 'indexerror:': 0.16; 'iterable,': 0.16; 'monitors': 0.16; 'months)': 0.16; 'received:mac.com': 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; 'subject:python': 0.16; 'exception': 0.16; 'index': 0.16; 'code.': 0.18; 'library': 0.18; 'bit': 0.19; 'trying': 0.19; "python's": 0.19; 'received:10.0.1': 0.19; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'error': 0.23; 'module,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'logging': 0.26; 'raise': 0.29; 'said,': 0.30; "i'm": 0.30; 'code': 0.31; '(maybe': 0.31; 'maintenance,': 0.31; 'occurs': 0.31; 'file': 0.32; 'run': 0.32; 'quite': 0.32; '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; 'addresses,': 0.36; 'interact': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'received:10.0': 0.36; 'two': 0.37; 'list': 0.37; 'received:10': 0.37; 'being': 0.38; 'loss': 0.38; 'checks': 0.38; 'received:17': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; '12,': 0.39; 'bill': 0.39; 'to:addr:python.org': 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; 'harness': 0.84; 'launches': 0.84; 'subject:source': 0.84; 'nights': 0.91; 'hands': 0.96
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:5.10.8626,1.0.431,0.0.0000 definitions=2013-04-24_08:2013-04-24, 2013-04-24, 1970-01-01 signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1302030000 definitions=main-1304240161
From William Ray Wing <wrw@mac.com>
Content-type text/plain; charset=us-ascii
Content-transfer-encoding quoted-printable
Subject Finding the source of an exception in a python multiprocessing program
Date Wed, 24 Apr 2013 15:25:48 -0400
To "python-list@python.org" <python-list@python.org>
MIME-version 1.0 (Mac OS X Mail 6.3 \(1503\))
X-Mailer Apple Mail (2.1503)
Cc William Ray Wing <wrw@mac.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1032.1366835159.3114.python-list@python.org> (permalink)
Lines 66
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366835159 news.xs4all.nl 15998 [2001:888:2000:d::a6]:59910
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44289

Show key headers only | View raw


I run a bit of python code that monitors my connection to the greater Internet.  It checks connectivity to the requested target IP addresses, logging both successes and failures, once every 15 seconds.  I see failures quite regularly, predictably on Sunday nights after midnight when various networks are undergoing maintenance.  I'm trying to use python's multiprocessing library to run multiple copies in parallel to check connectivity to different 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 <module>
    Foo = pool.map(monitor, targets)    # and hands off two targets
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/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/multiprocessing/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 = ["8.8.8.8", "www.ncsa.edu"]
pool = Pool(processes=2)            # start 2 worker processes
Foo = pool.map(monitor, targets)    # and hands off two targets


Line 12, in my code is simply the line that launches the underlying monitor code.  I'm assuming that the real error is occurring in the monitor program that is being launched, but I'm at a loss as to what to do to get a better handle on what's going wrong. Since, as I said, I see failures quite regularly, typically on Sunday nights after midnight when various networks are 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, timeout=None) on the line after the final else:

    def get(self, timeout=None):
        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

Thanks for any suggestions,
Bill

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Finding the source of an exception in a python multiprocessing program William Ray Wing <wrw@mac.com> - 2013-04-24 15:25 -0400
  Re: Finding the source of an exception in a python multiprocessing program Neil Cerutti <neilc@norwich.edu> - 2013-04-24 20:31 +0000
    Re: Finding the source of an exception in a python multiprocessing program William Ray Wing <wrw@mac.com> - 2013-04-24 17:09 -0400
      Re: Finding the source of an exception in a python multiprocessing program Neil Cerutti <neilc@norwich.edu> - 2013-04-25 12:37 +0000
    Re: Finding the source of an exception in a python multiprocessing program Dave Angel <davea@davea.name> - 2013-04-24 19:26 -0400
    Re: Finding the source of an exception in a python multiprocessing program Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-25 01:00 +0100
    Re: Finding the source of an exception in a python multiprocessing program Dave Angel <davea@davea.name> - 2013-04-24 20:11 -0400

csiph-web