Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forking on macOS #277

Open
ekun0608 opened this issue May 23, 2023 · 2 comments
Open

Forking on macOS #277

ekun0608 opened this issue May 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ekun0608
Copy link

ekun0608 commented May 23, 2023

Running the test demo on macOS 10.15.7 (in a conda environment with python 3.10.11) results in an error
"The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC() to debug.”

To reproduce it run python -m unittest discover tests/

Apparently fork() is unsafe on macOS, spawn* functions should be used instead.

I solved the problem of forking by adding the line mp.set_start_method('forkserver') below the if __name__ == "__main_": line of multiprocess_wrapper.py.

@mlincett
Copy link
Collaborator

Thanks @ekun0608 for reporting. Would you mind providing a semi-complete log including the lines before the error appears?

Maybe @JannisNe has a Mac and can confirm this issue?

@mlincett mlincett added the bug Something isn't working label May 23, 2023
@ekun0608
Copy link
Author

ekun0608 commented May 23, 2023

.INFO:root:Testing 'fixed_weight' MinimisationHandler class
...
.INFO:root:Testing MinimisationHandler analysis chain
WARNING:flarestack.cluster.submitter:No submitter implemented for host server None! Using LocalSubmitter but you wont't be able to use cluster operations!
INFO:flarestack.core.minimisation:Using 'standard' LLH class
INFO:flarestack.core.injector:Initialising Injector for IC86-2011
INFO:flarestack.core.multiprocess_wrapper:Added 140 trials to queue. Now processing.
INFO:flarestack.core.multiprocess_wrapper:140 tasks remaining.
140
INFO:flarestack.core.minimisation:Using 'standard' LLH class
INFO:flarestack.core.minimisation:Using 'standard' LLH class
INFO:flarestack.core.minimisation:Using 'standard' LLH class
INFO:flarestack.utils.create_acceptance_functions:Saving IC86-2011 acceptance values to: /Users/kunemma/flarestack/flarestack/analyses/stacking/scratch/flarestack__data/input/acceptance_functions/all_sky_3_year/IC86-2011.pkl
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().

and then the same lines from "Break on" to "You MUST exec()." many many times. Modules before that work well (Testing get_diffuse_flux util functions. Testing get_rates util functions.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants