diff --git a/billiard/pool.py b/billiard/pool.py index 4741beb0..c7189039 100644 --- a/billiard/pool.py +++ b/billiard/pool.py @@ -142,6 +142,10 @@ def error(msg, *args, **kwargs): if util._logger: util._logger.error(msg, *args, **kwargs) +def critical(msg, *args, **kwargs): + if util._logger: + util._logger.critical(msg, *args, **kwargs) + def stop_if_not_current(thread, timeout=None): if thread is not threading.currentThread(): @@ -1116,10 +1120,16 @@ def _join_exited_workers(self, shutdown=False): if acked_by_gone: self.on_job_process_down(job, acked_by_gone) if not job.ready(): + if acked_by_gone not in exitcodes: + critical("Ghost acked_by_gone %r from job %s with worker pids %s", acked_by_gone, job, job.worker_pids()) + exitcode = exitcodes[acked_by_gone] if getattr(cleaned[acked_by_gone], '_job_terminated', False): - job._set_terminated(exitcode) + if exitcode: + job._set_terminated(exitcode) + else: + job._set_terminated() else: self.on_job_process_lost( job, acked_by_gone, exitcode,