Jakub Kulik <kulik...@gmail.com> added the comment:
I investigated a little bit more and found out that this happens when `ProcessPoolExecutor::_adjust_process_count()` adds a new process during the iteration. With the following change, I can reproduce this reliably every time: --- Python-3.9.1/Lib/concurrent/futures/process.py +++ Python-3.9.1/Lib/concurrent/futures/process.py @@ -373,7 +373,14 @@ class _ExecutorManagerThread(threading.T assert not self.thread_wakeup._closed wakeup_reader = self.thread_wakeup._reader readers = [result_reader, wakeup_reader] - worker_sentinels = [p.sentinel for p in self.processes.values()] + worker_sentinels = [] + for p in self.processes.values(): + time.sleep(1) + worker_sentinels.append(p.sentinel) ready = mp.connection.wait(readers + worker_sentinels) cause = None Since `wait_result_broken_or_wakeup()` is called periodically, and there is no issue if processes added during the iteration are omitted (if they were added just after that, they would be omitted anyway), the attached PR shouldn't break anything. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43498> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com