Skip to content

Fix race condition on test node shutdown #6509

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
Aug 17, 2015
Merged

Fix race condition on test node shutdown #6509

merged 1 commit into from
Aug 17, 2015

Conversation

casey
Copy link
Contributor

@casey casey commented Aug 3, 2015

This fixes a race condition where the block store or the transaction store might be accessed after being closed. To fix this, we wait until all connections are closed before closing the stores.

This race condition is tricky to trigger, but I hit it when writing an extended block acceptance test.

@sdaftuar
Copy link
Member

sdaftuar commented Aug 5, 2015

utACK

def wait_for_disconnections(self):
def disconnected():
return all(node.closed for node in self.test_nodes)
wait_until(disconnected, timeout=10)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe return wait_until so that callers know whether it succeeded or timed out? (same for other wait_for_XXX)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems reasonable to me, changed.

@laanwj laanwj merged commit 45a6cce into bitcoin:master Aug 17, 2015
laanwj added a commit that referenced this pull request Aug 17, 2015
45a6cce Fix race condition on test node shutdown (Casey Rodarmor)
@laanwj laanwj mentioned this pull request Aug 21, 2015
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants