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

Fix possible deadlock in neuron update loop in multithreaded code (fixes #718) #734

Merged
merged 1 commit into from
May 29, 2017

Conversation

heplesser
Copy link
Contributor

This PR fixes a potential deadlock when a neuron throws an exception during multithreaded simulation (#718).

Since it is difficult to test for deadlocks in unittests, there is no automated test. This manual test is inspired by @maharjun's deadlock module. To test, add the following to the beginning of iaf_psc_alpha::update():

 if ( this->get_thread() == 2 )
	  throw KernelException("Thread 2");

and run the following SLI script from a file

0 << /local_num_threads 4 >> SetStatus
/iaf_psc_alpha 10 Create ;
10 Simulate

NEST should hang if you use current master; with the correction given here, NEST should terminate with an error message.

@maharjun Would you test and review this fix?

@heplesser heplesser added ZC: Kernel DO NOT USE THIS LABEL I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) ZP: PR Created DO NOT USE THIS LABEL S: High Should be handled next T: Bug Wrong statements in the code or documentation labels May 26, 2017
@maharjun
Copy link
Contributor

I have tested it and can confirm that this works correctly.

Copy link
Contributor

@sanjayankur31 sanjayankur31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me. 👍

@heplesser
Copy link
Contributor Author

Merging as tests pass and two reviewers confirmed that the deadlock no longer occurs.

@heplesser heplesser merged commit 0a0d2f2 into nest:master May 29, 2017
@heplesser heplesser deleted the fix-718-deadlock branch May 29, 2017 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: High Should be handled next T: Bug Wrong statements in the code or documentation ZC: Kernel DO NOT USE THIS LABEL ZP: PR Created DO NOT USE THIS LABEL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants