From 126e11d34e357213035b15e3f4c55de29e4b28f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Mon, 14 Oct 2024 21:35:32 +0200 Subject: [PATCH] utils: fall back to 'spawn' process pool on WSL1 On Windows WSL1, the 'forkserver' method does not work because UNIX domain sockets are not fully implemented. This manifests itself by an EOFError because the forked server crashes during initialization. If that happens we fall back to the 'spawn' method that is supposed to work, even though its slow. Fixes #562. --- pym/bob/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pym/bob/utils.py b/pym/bob/utils.py index d3fa5084..d6677344 100644 --- a/pym/bob/utils.py +++ b/pym/bob/utils.py @@ -719,6 +719,12 @@ def getProcessPoolExecutor(): executor.submit(dummy).result() finally: signal.signal(signal.SIGINT, origSigInt) + except EOFError: + # On Windows WSL1, the 'forkserver' method does not work because UNIX + # domain sockets are not fully implemented. Fall back to the 'spawn' + # method. See bug #562. + multiprocessing.set_start_method('spawn', force=True) + executor = concurrent.futures.ProcessPoolExecutor() except OSError as e: raise BuildError("Error spawning process pool: " + str(e))