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


Groups > comp.lang.python > #44300

Re: Finding the source of an exception in a python multiprocessing program

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'attribute': 0.07; 'failing': 0.07; 'get(self,': 0.09; 'hiding': 0.09; 'python': 0.11; 'def': 0.12; '24,': 0.16; 'letting': 0.16; 'received:74.208.4.195': 0.16; 'storing': 0.16; 'subject: \n ': 0.16; 'subject:exception': 0.16; 'subject:program': 0.16; 'subject:skip:m 10': 0.16; 'threads,': 0.16; 'wing': 0.16; 'subject:python': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'module': 0.19; '>>>': 0.22; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'error': 0.23; 'module,': 0.24; 'sorry,': 0.24; 'question': 0.24; 'somewhere': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'raise': 0.29; 'thus': 0.29; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'context.': 0.31; 'crash': 0.31; 'ray': 0.31; 'routine': 0.31; 'class': 0.32; 'url:python': 0.33; 'guess': 0.33; 'actual': 0.34; 'subject:the': 0.34; "i'd": 0.34; 'there': 0.35; 'interact': 0.36; 'library.': 0.36; 'scheduled': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'clear': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'most': 0.60; "you're": 0.61; 'you.': 0.62; 'more': 0.64; 'received:74.208': 0.68; 'further,': 0.74; 'william': 0.81; 'subject:source': 0.84; '2013,': 0.91
Date Wed, 24 Apr 2013 19:26:36 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
MIME-Version 1.0
To python-list@python.org
Subject Re: Finding the source of an exception in a python multiprocessing program
References <mailman.1032.1366835159.3114.python-list@python.org> <atqtpaFa3niU2@mid.individual.net> <5BC4D9D9-D757-40F3-81CA-CF4FA5C73A96@mac.com>
In-Reply-To <5BC4D9D9-D757-40F3-81CA-CF4FA5C73A96@mac.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:cJMsG10+ZfNdbq8JfuP7WMtYIaqtgt/rdt/bTBRi021 iid+CB98Oj0d+Zjtud+ladTM6ZMz4dpG0jNuIWhurc3C4w0ZyY g50oTNrukW+vVIkx1VMB3BPDZIrge21LQK0EOYzwV48whzCtpv 6kCoq0eNqS0heQeeNUE/fM9o37iT1s7YBS5kCQTs4fIT793fV5 iZN7zZQAbB+al0oMuDmh1IVrokNzUyNa5dReZnxV89eFfmp7LY qasl25KdJlsP2VuwFvTT5/reW04HA0axO2baAz1tOXIFcy87hP Esa+cXL4BBFNAjt6Mj7vwdSRCJkcLT1vUZvTtjuflZy9Iakog= =
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.1037.1366846014.3114.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1366846014 news.xs4all.nl 15910 [2001:888:2000:d::a6]:45353
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44300

Show key headers only | View raw


On 04/24/2013 05:09 PM, William Ray Wing wrote:
> On Apr 24, 2013, at 4:31 PM, Neil Cerutti <neilc@norwich.edu> wrote:
>
>> On 2013-04-24, William Ray Wing <wrw@mac.com> wrote:
>>> 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
>>
>> The code that's failing is in self.wait. Somewhere in there you
>> must be masking an exception and storing it in self._value
>> instead of letting it propogate and crash your program. This is
>> hiding the actual context.
>>
>> --
>> Neil Cerutti
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
> I'm sorry, I'm not following you.  The "get" routine (and thus self.wait) is part of the "pool" module in the Python multiprocessing library.
> None of my code has a class or function named "get".
>
> -Bill
>

My question is why bother with multithreading?  Why not just do these as 
separate processes?  You said "they in no way interact with each other" 
and that's a clear clue that separate processes would be cleaner.

Without knowing anything about those libraries, I'd guess that somewhere 
they do store state in a global attribute or equivalent, and when that 
is accessed by both threads, it can crash.

Separate processes will find it much more difficult to interact, which 
is a good thing most of the time.  Further, they seem to be scheduled 
more efficiently because of the GIL, though that may not make that much 
difference when you're time-limited by network data.

-- 
DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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