commit: 81684037aef38a3a3d3b321bffc953f73b2eabd8 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Thu Sep 11 01:22:09 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Thu Sep 11 03:16:43 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=81684037
Revert "process: do not poll join() in MultiprocessingProcesss" This reverts commit 8b96ca57e15bbc989f39ec4973fc3c9492fcc059. This seems to make tests hang in CI. Reverting pending investigation. It can of course be reapplied once we've figured out what's going on and fixed as necessary. Bug: https://bugs.gentoo.org/958635 Bug: https://bugs.gentoo.org/962721 Signed-off-by: Sam James <sam <AT> gentoo.org> Part-of: https://github.com/gentoo/portage/pull/1457 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/process.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/portage/process.py b/lib/portage/process.py index 977fe53fe7..d252cc7c4a 100644 --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -428,6 +428,10 @@ class MultiprocessingProcess(AbstractProcess): An object that wraps OS processes created by multiprocessing.Process. """ + # Number of seconds between poll attempts for process exit status + # (after the sentinel has become ready). + _proc_join_interval = 0.1 + def __init__(self, proc: multiprocessing.Process): self._proc = proc self.pid = proc.pid @@ -478,7 +482,13 @@ class MultiprocessingProcess(AbstractProcess): except ValueError: pass - await loop.run_in_executor(None, proc.join) + # Now that proc.sentinel is ready, poll until process exit + # status has become available. + while True: + proc.join(0) + if proc.exitcode is not None: + break + await asyncio.sleep(self._proc_join_interval, loop=loop) def _proc_join_done(self, future): # The join task should never be cancelled, so let it raise
