ddsmt / ddSMT

A delta debugger for SMT benchmarks in SMT-LIB v2.
https://ddsmt.readthedocs.io
Other
50 stars 17 forks source link

Ensure that child processes are forked, not spawned. #25

Closed 4tXJ7f closed 3 years ago

4tXJ7f commented 3 years ago

On macOS (I tested 11.3.1 with Python version 3.9.5), child processes seem to be spawned instead of forked by default:

>>> import multiprocessing
>>> multiprocessing.get_context()
<multiprocessing.context.SpawnContext object at 0x104092280>

This causes issues with global variables such as __TMPDIR in tmpfiles.py, which is None for children when the process is spawned instead of forked. This commit fixes the issue by setting the multiprocessing context explicitly. The commit also moves the manipulation of sys.path and the import of the ddsmt module after changing the context. Otherwise, the context is already implicitly set when we get to if __name__ == '__main__'.