diff options
author | grzgrzgrz3 <grzgrzgrz3@gmail.com> | 2017-05-25 14:22:57 (GMT) |
---|---|---|
committer | Antoine Pitrou <pitrou@free.fr> | 2017-05-25 14:22:57 (GMT) |
commit | bc50f03db4f58c869b78e98468e374d7e61f1227 (patch) | |
tree | 432d3da98baf4590ccf03e2a6ddb4e797a363fab /Lib/multiprocessing | |
parent | 7ff1e88a57a37a4cca3af9b0a3528b703d975ea2 (diff) | |
download | cpython-bc50f03db4f58c869b78e98468e374d7e61f1227.zip cpython-bc50f03db4f58c869b78e98468e374d7e61f1227.tar.gz cpython-bc50f03db4f58c869b78e98468e374d7e61f1227.tar.bz2 |
bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (#1683)
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc
Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc
Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/queues.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py index a4f4ef8..7f77837 100644 --- a/Lib/multiprocessing/queues.py +++ b/Lib/multiprocessing/queues.py @@ -221,8 +221,8 @@ class Queue(object): else: wacquire = None - try: - while 1: + while 1: + try: nacquire() try: if not buffer: @@ -249,21 +249,19 @@ class Queue(object): wrelease() except IndexError: pass - except Exception as e: - if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: - return - # Since this runs in a daemon thread the resources it uses - # may be become unusable while the process is cleaning up. - # We ignore errors which happen after the process has - # started to cleanup. - try: + except Exception as e: + if ignore_epipe and getattr(e, 'errno', 0) == errno.EPIPE: + return + # Since this runs in a daemon thread the resources it uses + # may be become unusable while the process is cleaning up. + # We ignore errors which happen after the process has + # started to cleanup. if is_exiting(): info('error in queue thread: %s', e) + return else: import traceback traceback.print_exc() - except Exception: - pass _sentinel = object() |