Skip to content

fix semaphore acquire bug #1689

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

Merged
merged 1 commit into from
Oct 21, 2016
Merged

fix semaphore acquire bug #1689

merged 1 commit into from
Oct 21, 2016

Conversation

carolFrohlich
Copy link
Contributor

There was a bug on how the semaphore of the multiproc plugin was initialized and released.
The semaphore counter was initialized with 1, being acquired over and over again and never released.
That is because semaphore.acquire() was called more times than semaphore.release(), so the semaphore internal counter would always be > 0, leading to the master process to be active all the time.

We noticed that bug because the master process of the run was utilizing 100% cpu, even on the times it was supposed to be sleeping.

This fix makes the multiproc plugin have the expected behavior: the main process sleeps when it is waiting for jobs to finish.
Besides that, the multiproc plugin still works exactly the same as before.

@blakedewey
Copy link
Contributor

+1 for this. Noticed this recently and it completely changed how I have to run my processes. I couldn't narrow it down though.

@chrisgorgo
Copy link
Member

LGTM, but let's wait for the tests to finish. Thanks for sending this!

@satra satra merged commit 03f2f55 into nipy:master Oct 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants