Skip to content

Commit

Permalink
utils: fall back to 'spawn' process pool on WSL1
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jkloetzke committed Oct 14, 2024
1 parent 2ee83b7 commit 126e11d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pym/bob/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,12 @@ def getProcessPoolExecutor():
executor.submit(dummy).result()
finally:
signal.signal(signal.SIGINT, origSigInt)
except EOFError:

Check warning on line 722 in pym/bob/utils.py

View check run for this annotation

Codecov / codecov/patch

pym/bob/utils.py#L722

Added line #L722 was not covered by tests
# 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()

Check warning on line 727 in pym/bob/utils.py

View check run for this annotation

Codecov / codecov/patch

pym/bob/utils.py#L726-L727

Added lines #L726 - L727 were not covered by tests
except OSError as e:
raise BuildError("Error spawning process pool: " + str(e))

Expand Down

0 comments on commit 126e11d

Please sign in to comment.