Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions 22 Lib/multiprocessing/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def _feed(buffer, notempty, send_bytes, writelock, close, ignore_epipe):
else:
wacquire = None

try:
while 1:
while 1:
try:
nacquire()
try:
if not buffer:
Expand All @@ -249,21 +249,19 @@ def _feed(buffer, notempty, send_bytes, writelock, close, ignore_epipe):
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()

Expand Down
14 changes: 14 additions & 0 deletions 14 Lib/test/_test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,20 @@ def test_timeout(self):
# Windows (usually 15.6 ms)
self.assertGreaterEqual(delta, 0.170)

def test_queue_feeder_donot_stop_onexc(self):
# bpo-30414: verify feeder handles exceptions correctly
if self.TYPE != 'processes':
self.skipTest('test not appropriate for {}'.format(self.TYPE))

class NotSerializable(object):
def __reduce__(self):
raise AttributeError
with test.support.captured_stderr():
q = self.Queue()
q.put(NotSerializable())
q.put(True)
self.assertTrue(q.get(timeout=0.1))

#
#
#
Expand Down
3 changes: 3 additions & 0 deletions 3 Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ Extension Modules
Library
-------

- bpo-30414: multiprocessing.Queue._feed background running
thread do not break from main loop on exception.

- bpo-30003: Fix handling escape characters in HZ codec. Based on patch
by Ma Lin.

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.