OpenSesame icon indicating copy to clipboard operation
OpenSesame copied to clipboard

'spawn' multiprocessing method crashes, need to manually revert commit

Open dev-jam opened this issue 2 years ago • 2 comments

The new spawn method for multiprocessing makes opensesame on debian bullseye (python 3.9) and bookworm (python 3.10) unusable on my machines. The main window crashes but it keeps the experiment running for some time. This happens both with psychopy and expyriment as backend.

When I comment out the new method in the following commit, everything works fine again:

	# Appears more stable when running experiments on Linux, where fork is the 
	# default multiprocessing method.
	#multiprocessing.set_start_method('spawn')
	# solves a library conflict for Linux with Nvidia drivers
	# See https://forum.qt.io/topic/81328/ubuntu-qopenglshaderprogram-shader-program-is-not-linked/2

commit: https://github.com/open-cogsci/OpenSesame/commit/b42a91feeb341fe5d35e5b20ed21a9a463a327f7

Some relevant debug info:

INFO:traitlets:KernelRestarter: restarting kernel (1/5), keep random ports
WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel died: 3.0001235008239746
Bad file descriptor (src/epoll.cpp:145)
Aborted (core dumped)

/usr/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 9 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

The last error seems like a bug in python 3.10

Machines I tested were nvidia and intel gpu machines.

dev-jam avatar Dec 06 '22 22:12 dev-jam

Thanks. It seems that different multiprocessing methods have different issues on different systems, so I don't want to revert this commit just yet. As a hacky workaround, you can now specify the multiprocessing method on Linux by setting the OPENSESAME_MULTIPROCESSING_METHOD environment variable. In other words, running the following command in the terminal will allow you to change the method from spawn to fork:

export OPENSESAME_MULTIPROCESSING_METHOD=fork && opensesame

Let's keep this on the radar.

smathot avatar Dec 07 '22 09:12 smathot

Thanks! That is an elegant and easy to maintain solution/workaround. I put a conf file with this env variable in /etc/environment.d and it works perfectly.

dev-jam avatar Dec 07 '22 20:12 dev-jam