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

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

Open
dev-jam opened this issue Dec 6, 2022 · 2 comments
Open
Assignees
Labels

Comments

@dev-jam
Copy link
Contributor

dev-jam commented Dec 6, 2022

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: b42a91f

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.

@smathot smathot self-assigned this Dec 7, 2022
@smathot smathot added the Bug label Dec 7, 2022
smathot added a commit that referenced this issue Dec 7, 2022
@smathot
Copy link
Collaborator

smathot commented Dec 7, 2022

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.

@dev-jam
Copy link
Contributor Author

dev-jam commented Dec 7, 2022

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.

smathot added a commit that referenced this issue May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants