python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
69 stars 41 forks source link

Fork issue on macos 10.14 #106

Closed iandobbie closed 4 years ago

iandobbie commented 4 years ago

On my mac laptop starting the ximea camera gives and error :

objc[16270]: +[__NSPlaceholderDate initialize] may have been in progress in another thread when fork() was called.

Solution from...

https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

before starting microscope

Mick suggests we put this into the system environment if we are running on a mac.

carandraug commented 4 years ago

This seems to be Python issue #33725 and kind of fixed since Python 3.8 by change of default method to start a new process.

Basically, when starting another process, this can be done using spawn, fork, and forkserver. The fork method is considered unsafe in MacOSX and spawn is recommended. The default used to be fork but since Python 3.8 the default is spawn.

@iandobbie , could you check whether the branch "wip-macosx-spawn-issue106" on my fork fixes the issue for you?

carandraug commented 4 years ago

Merged and pushed. Closing as fixed.