Merge pull request #8957 from tk0miya/8952_hangup_on_parallel_build

Fix #8952: Exceptions raised in a Directive cause parallel builds to hang
This commit is contained in:
Takeshi KOMIYA 2021-03-06 17:30:00 +09:00 committed by GitHub
commit ad10c62d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -16,6 +16,8 @@ Features added
Bugs fixed
----------
* #8952: Exceptions raised in a Directive cause parallel builds to hang
Testing
--------

View File

@ -103,8 +103,21 @@ class ParallelTasks:
self._join_one()
def join(self) -> None:
try:
while self._pworking:
self._join_one()
except Exception:
# shutdown other child processes on failure
self.terminate()
raise
def terminate(self) -> None:
for tid in list(self._precvs):
self._procs[tid].terminate()
self._result_funcs.pop(tid)
self._procs.pop(tid)
self._precvs.pop(tid)
self._pworking -= 1
def _join_one(self) -> None:
for tid, pipe in self._precvs.items():