chore: properly await async monitoring requests during shutdown#8896
chore: properly await async monitoring requests during shutdown#8896
Conversation
Summary of ChangesHello @wemeetagain, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the shutdown sequence of the beacon node by correctly awaiting asynchronous operations and reordering the abort signal. The changes ensure that all pending database writes and network requests are completed before components fully close, preventing potential data corruption or errors during node shutdown and improving the reliability of the shutdown process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e969449ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request provides a solid improvement to the beacon node's shutdown sequence, making it more robust and reliable. By properly awaiting asynchronous close operations in MonitoringService and BackfillSync, and re-ordering the shutdown logic in BeaconNode, potential race conditions are eliminated. The refactoring in BackfillSync to manage its lifecycle and cleanup via a stored promise is a clean solution. Moving the controller.abort() call to the beginning of the shutdown sequence is a great change to prevent new work from being initiated during shutdown. Overall, these are excellent changes that increase the stability of the node.
Performance Report🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
6e96944 to
e7e7497
Compare
- Await backfillSync.close() by storing sync loop promise and waiting for in-flight DB writes to complete. Moved after network.close() so in-flight req/resp calls are terminated first. - Await monitoring.close() pending HTTP request after aborting fetch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e7e7497 to
2544481
Compare
nflaig
left a comment
There was a problem hiding this comment.
@wemeetagain this needs to be tested on a running node, I don't see any issues when currently shutting down the node, doens't mean it's ideal, and this PR might improve things but need to make sure this doesn't make the status quo worse
There was a problem hiding this comment.
reduced this PR to minimal useful changes, which is awaiting pending requests in monitoring service before closing it (although even that is a bit unnecessary)
the most value this PR adds is the comment in close() which clarifies why we wanna abort() last
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #8896 +/- ##
=========================================
Coverage 52.33% 52.34%
=========================================
Files 848 848
Lines 63283 63274 -9
Branches 4694 4694
=========================================
- Hits 33119 33118 -1
+ Misses 30095 30087 -8
Partials 69 69 🚀 New features to boost your workflow:
|
Summary
AwaitEdit nflaig: I removed that change, the code is unusedbackfillSync.close(): Store the internal sync loop promise and await it inclose(), ensuring in-flight DB writes complete before shutdown continues. Moved afternetwork.close()so in-flight req/resp calls are terminated first.monitoring.close(): After aborting the fetch controller, await the pending HTTP request so it resolves cleanly🤖 Generated with Claude Code