High CPU load prevention: cancellation safety for AsyncReceiver#52
Merged
bvscd merged 1 commit intorelease/node/v0.4.0from Apr 2, 2026
Merged
High CPU load prevention: cancellation safety for AsyncReceiver#52bvscd merged 1 commit intorelease/node/v0.4.0from
bvscd merged 1 commit intorelease/node/v0.4.0from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses high CPU load prevention by implementing cancellation-safe counter management in AsyncReceiver. The changes ensure that when async tasks are cancelled while awaiting, internal state is properly maintained to prevent busy-waiting loops that consume excessive CPU.
Changes:
- Introduces
SyncGuardstruct to provide RAII-based cancellation-safe counter management that decrements even when futures are dropped - Modifies
AsyncReceiver::pop()to use the guard instead of manual fetch_add/fetch_sub calls - Moves stats recording in
QuicNode::query()to after successful query completion to only record completed queries
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/adnl/src/adnl/common.rs | Adds SyncGuard struct and updates AsyncReceiver::pop() to use it for cancellation safety |
| src/adnl/src/quic/mod.rs | Moves msg_stats.record() to after successful query response |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sumrachek
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.