Use atomic enabled flag in request_aggregator::request#5022
Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom Feb 2, 2026
Merged
Use atomic enabled flag in request_aggregator::request#5022pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev merged 1 commit intonanocurrency:developfrom
Conversation
Test Results for Commit ddf7eb5Pull Request 5022: Results Test Case Results
Last updated: 2026-02-02 16:16:51 UTC |
Contributor
There was a problem hiding this comment.
Pull request overview
Addresses a ThreadSanitizer-reported data race in nano::request_aggregator::request() by avoiding unsynchronized access to the threads vector during shutdown.
Changes:
- Introduces an
std::atomic<bool> enabledflag to gate request acceptance without readingthreads.empty(). - Switches
start()andrequest()to use the new flag. - Removes an unused lambda capture in
queue.priority_query.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| nano/node/request_aggregator.hpp | Adds an atomic enabled flag member to control request acceptance. |
| nano/node/request_aggregator.cpp | Uses the atomic flag to avoid the threads.empty() access that triggered TSAN. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| using value_type = std::pair<request_type, std::shared_ptr<nano::transport::channel>>; | ||
| nano::fair_queue<value_type, nano::no_value> queue; | ||
|
|
||
| std::atomic<bool> enabled{ true }; |
There was a problem hiding this comment.
std::atomic<bool> is used here but this header doesn't include <atomic>. Please add the missing include to avoid relying on transitive includes / include-order (this can fail to compile in some translation units).
ddf7eb5 to
46dd17e
Compare
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.
Should fix: