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

P2P: Check for is_quitting() for faster shutdown #950

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

heifner
Copy link
Member

@heifner heifner commented Oct 18, 2024

For large sync-fetch-span, shutdown can be slow as there can be many queued up blocks to process on the dispatcher strand. Check for app().is_quitting() for faster shutdown. This provides a noticable improvement in response to ctrl-c shutdown request.

Related to #922

@heifner heifner added the OCI Work exclusive to OCI team label Oct 18, 2024
@heifner heifner added this to the Spring v1.1.0-rc1 milestone Oct 18, 2024
@@ -3694,6 +3694,8 @@ namespace eosio {
// post to dispatcher strand so that we don't have multiple threads validating the block header
peer_dlog(this, "posting block ${n} to dispatcher strand", ("n", ptr->block_num()));
my_impl->dispatcher.strand.post([id, c{shared_from_this()}, ptr{std::move(ptr)}, cid=connection_id]() mutable {
if (app().is_quiting()) // large sync span can have many of these queued up, exit quickly
Copy link
Member

Choose a reason for hiding this comment

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

Why not check this before post?

Copy link
Member Author

Choose a reason for hiding this comment

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

The only thing that happens before the post is pulling the block off the wire. The expensive part is done inside this post. So this implicit queue can become large. The check needs to be inside since that is what is queued up.

@heifner heifner merged commit f45de1f into main Oct 18, 2024
36 checks passed
@heifner heifner deleted the p2p-shutdown branch October 18, 2024 17:44
@ericpassmore
Copy link
Contributor

Note:start
category: Enhancement
component: Internal
summary: Speed up shutdown when configured with large sync span.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants