diff -r ccde4da4d0de Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py Mon Aug 24 12:56:24 2015 -0400 +++ b/Lib/multiprocessing/pool.py Tue Aug 25 20:21:31 2015 +0200 @@ -20,6 +20,7 @@ import os import time import traceback +import warnings # If threading is available then ThreadPool should be provided. Therefore # we avoid top-level imports which are liable to fail on some systems. @@ -46,6 +47,10 @@ def starmapstar(args): return list(itertools.starmap(args[0], args[1])) + +class WorkerTerminatedPrematurely(Warning): + pass + # # Hack to embed stringification of remote traceback in local traceback # @@ -209,6 +214,14 @@ for i in reversed(range(len(self._pool))): worker = self._pool[i] if worker.exitcode is not None: + if worker.exitcode != 0: + # worker terminated prematurely + warnings.warn( + "Worker %d ended prematurely with exit code %d" % ( + i, worker.exitcode + ), + WorkerTerminatedPrematurely + ) # worker exited util.debug('cleaning up worker %d' % i) worker.join()