Skip to content

fix: speed up node shutdown#5408

Open
sbackend123 wants to merge 1 commit intomasterfrom
fix/shutdown-node
Open

fix: speed up node shutdown#5408
sbackend123 wants to merge 1 commit intomasterfrom
fix/shutdown-node

Conversation

@sbackend123
Copy link
Copy Markdown
Contributor

Fixed order of closing components. Removed unnecessary logging. Made Close() methods safer. Fixed context in pull sync component.

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Context: see the linked issue

What was done:

  • Fixed the shutdown order of storages. Previously, StateStore was closed before LocalStore. LocalStore uses BatchStore, which depends on StateStore. During shutdown or in-flight work, BatchStore could access StateStore, causing failed Put/Get operations, with a risk of incomplete flush and inconsistent local state.

  • Fixed a context handling issue in the pull sync component. Upon receiving a shutdown signal, the component waited 10 seconds to allow its sub-goroutines to terminate gracefully. However, the sub-goroutines did not receive the context cancellation signal.

  • Added logs to track how long each component takes to shut down.

  • Removed warning logs in libp2p for context cancellation when the node is shutting down, to avoid log noise.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

#5397

Screenshots (if appropriate):

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

@sbackend123 sbackend123 changed the title fix: speed up node shutdown. fix: speed up node shutdown Mar 23, 2026
Fixed order of closing components. Removed unnecessary logging. Made Close() methods safer. Fixed context in pull sync component.
@sbackend123 sbackend123 marked this pull request as ready for review March 25, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant