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 bootstrap serving threads regression #3898

Merged

Conversation

pwojcikdev
Copy link
Contributor

There is a regression where bootstrap servers (bulk_pull_server, bulk_pull_account_server, bulk_push_server, frontier_req_server) are not using dedicated bootstrap threads when initializing. (I forgot to properly merge that part when rebasing bootstrap server fix). This PR fixes that.

@dsiganos
Copy link
Contributor

dsiganos commented Sep 1, 2022

Looks good to me. Except i wonder if there is a risk of the bootstrap_server being destructed before the callback is run and causing dangling pointers.

// TODO: Add completion callback to bulk pull server
auto bulk_pull_server = std::make_shared<nano::bulk_pull_server> (server, std::make_unique<nano::bulk_pull> (message));
bulk_pull_server->send_next ();
server->node->bootstrap_workers.push_task ([server = server, message = message] () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should server be a weak_pointer which becomes strong inside the callback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reference to bootstrap_server is only ever stored as weak_ptr in other places so we need to keep it non weak, otherwise it will get destroyed

@pwojcikdev pwojcikdev merged commit d05d407 into nanocurrency:develop Sep 1, 2022
@pwojcikdev pwojcikdev deleted the prs/fix-bootstrap-thread-pool branch September 1, 2022 20:05
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 this pull request may close these issues.

None yet

2 participants