summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-10-28 23:02:22 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-10-28 23:02:22 (GMT)
commit21aad9792f4f7ebaac76ca552851e937de2e1538 (patch)
treee43bdfc7764df5342a06b23fdb749050a89c9bf1 /Lib/multiprocessing
parent9a2325fac884e3e34af0476e05d6800cfba22ad8 (diff)
downloadcpython-21aad9792f4f7ebaac76ca552851e937de2e1538.zip
cpython-21aad9792f4f7ebaac76ca552851e937de2e1538.tar.gz
cpython-21aad9792f4f7ebaac76ca552851e937de2e1538.tar.bz2
Issue #19425 -- a pickling error should not cause pool to hang.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/pool.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index 4d18600..04531b9 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -169,7 +169,8 @@ class Pool(object):
self._task_handler = threading.Thread(
target=Pool._handle_tasks,
- args=(self._taskqueue, self._quick_put, self._outqueue, self._pool)
+ args=(self._taskqueue, self._quick_put, self._outqueue,
+ self._pool, self._cache)
)
self._task_handler.daemon = True
self._task_handler._state = RUN
@@ -329,7 +330,7 @@ class Pool(object):
debug('worker handler exiting')
@staticmethod
- def _handle_tasks(taskqueue, put, outqueue, pool):
+ def _handle_tasks(taskqueue, put, outqueue, pool, cache):
thread = threading.current_thread()
for taskseq, set_length in iter(taskqueue.get, None):
@@ -340,9 +341,12 @@ class Pool(object):
break
try:
put(task)
- except IOError:
- debug('could not put task on queue')
- break
+ except Exception as e:
+ job, ind = task[:2]
+ try:
+ cache[job]._set(ind, (False, e))
+ except KeyError:
+ pass
else:
if set_length:
debug('doing set_length()')