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

Bugfix: race condition between bootstrap pull and push #3720

Closed
dsiganos opened this issue Feb 8, 2022 · 0 comments · Fixed by #3721
Closed

Bugfix: race condition between bootstrap pull and push #3720

dsiganos opened this issue Feb 8, 2022 · 0 comments · Fixed by #3721
Assignees
Labels
Milestone

Comments

@dsiganos
Copy link
Contributor

dsiganos commented Feb 8, 2022

The unit test bootstrap_processor.push_one fails intermittently and it exposes a race condition in the bootstrap code of the node.
#3533

The race condition is that after finishing with bootstrap frontiers pull, the code is supposed to put the socket back into the idle boostrap connections queue. However it does that in a racy way. The problem is in function nano::frontier_req_client::received_frontier.

Near the bottom of that function, we should call:
connection->connections.pool_connection (connection);
before calling
promise.set_value (false);

Once the promise is given a value then nano::bootstrap_attempt_legacy::run continues to call push_request in parallel with pool_connection and it is a race condition.

Although this is a bug, this is likely not a major nor catastrophic bug because the bootstrap functionality is only an efficiency.

@dsiganos dsiganos added the bug label Feb 8, 2022
@dsiganos dsiganos added this to the V24.0 milestone Feb 8, 2022
@dsiganos dsiganos self-assigned this Feb 8, 2022
dsiganos added a commit to dsiganos/nano-node that referenced this issue Feb 8, 2022
The unit test bootstrap_processor.push_one fails intermittently and it
exposes a race condition in the bootstrap code of the node. nanocurrency#3533

The race condition is that after finishing with bootstrap frontiers pull,
the code is supposed to put the socket back into the idle bootstrap
connections queue. However it does that in a racy way. The problem is in
the function nano::frontier_req_client::received_frontier.

Near the bottom of that function, we should call:
connection->connections.pool_connection (connection);
before calling
promise.set_value (false);

Once the promise is given a value then
nano::bootstrap_attempt_legacy::run()
continues to call push_request in parallel with pool_connection and it is
a race condition.

Although this is a bug, this is likely not a major nor catastrophic bug
because the bootstrap push functionality is only an efficiency.

resolves nanocurrency#3533
resolves nanocurrency#3720
dsiganos added a commit that referenced this issue Feb 8, 2022
The unit test bootstrap_processor.push_one fails intermittently and it
exposes a race condition in the bootstrap code of the node. #3533

The race condition is that after finishing with bootstrap frontiers pull,
the code is supposed to put the socket back into the idle bootstrap
connections queue. However it does that in a racy way. The problem is in
the function nano::frontier_req_client::received_frontier.

Near the bottom of that function, we should call:
connection->connections.pool_connection (connection);
before calling
promise.set_value (false);

Once the promise is given a value then
nano::bootstrap_attempt_legacy::run()
continues to call push_request in parallel with pool_connection and it is
a race condition.

Although this is a bug, this is likely not a major nor catastrophic bug
because the bootstrap push functionality is only an efficiency.

resolves #3533
resolves #3720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant