summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-05-25 14:57:46 (GMT)
committerGitHub <noreply@github.com>2017-05-25 14:57:46 (GMT)
commit2783cc42629b9445ea848ce36bbf213ef7789271 (patch)
treecd71ebfa9971d7fe152d634b514f6bdf43d27eb9 /Lib/multiprocessing
parentf43b293f2fee91578e28c7aa566510a0cd6e33cb (diff)
downloadcpython-2783cc42629b9445ea848ce36bbf213ef7789271.zip
cpython-2783cc42629b9445ea848ce36bbf213ef7789271.tar.gz
cpython-2783cc42629b9445ea848ce36bbf213ef7789271.tar.bz2
[3.6] bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (GH-1683) (#1815)
* 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. (cherry picked from commit bc50f03db4f58c869b78e98468e374d7e61f1227)
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/queues.py22
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()