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 deadlock in tests #2043

Merged
merged 3 commits into from May 30, 2019

Conversation

@wezrule
Copy link
Collaborator

commented May 28, 2019

On Windows (at least) when running the tests it would often crash on node.fork_bootstrap_flip among other tests due to a mutex being locked which is already locked higher up in the stack. It is caused by bootstrap_initiator.stop () being called while the mutex is locked before the attempt = nullptr call. The attempt is holding the last reference to the node shared_ptr which may already have been stopped by the system::~system destructor which explicitly calls node->stop (). It then eventually calls bootstrap_initiator.stop () which leaks to a deadlock. There's probably a few ways to solve this, but this could be a problem with other node members (I have seen similar errors before) so I decided to add a check in node::stop to see if it has been stopped already before trying to stop again

@wezrule wezrule added this to the V19.0 milestone May 28, 2019

@wezrule wezrule requested a review from SergiySW May 28, 2019

@wezrule wezrule self-assigned this May 28, 2019

@SergiySW
Copy link
Collaborator

left a comment

LGTM

@wezrule wezrule requested a review from cryptocode May 28, 2019

@zhyatt zhyatt added this to During RC in V19 May 30, 2019

@zhyatt zhyatt moved this from During RC to RC 4 (TBD) in V19 May 30, 2019

@wezrule wezrule merged commit 41278fa into nanocurrency:master May 30, 2019

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@wezrule wezrule deleted the wezrule:fix_deadlock_bootstrap_initiator branch May 30, 2019

argakiig added a commit that referenced this pull request Jun 11, 2019

Fix deadlock in tests (#2043)
* Check if node has been stopped already

* Use std::atomic<bool>::exchange (thanks cryptocode)

* Add std::atomic<bool>::exchange to bootstrap_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.