fix: Concurrency issues in cache sizes initialization in service_topo.cpp #3853
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 293 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.340
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3853"
general
weight: 0.35
Vika-F
Description
Fix to the bug found by Copilot:
>Constructing any system_parameters now enters the cache-topology initialization path. That path is not thread-safe: service_topo.cpp:1615 uses a shared static CPUID buffer, and service_topo.cpp:1651-1659 coordinates writes with volatile rather than synchronization. Concurrent first-time algorithm calls can therefore race and even interleave results from different cache leaves, producing undefined behavior or corrupted sizes.
The array that encodes cache sizes was moved into
CacheSizeInfostructure. It is now initialized through a local static variable which guarantees thread safety.---
<!--
PR should start as a draft, then move to ready for review state
after CI is passed and all applicable checkboxes are closed.
This approach ensures that reviewers don't spend extra time asking for regular requirements.
You can remove a checkbox as not applicable only if it doesn't relate to this PR in any way.
For example, a PR with docs update doesn't require checkboxes for performance
while a PR with any change in actual code should list checkboxes and
justify how this code change is expected to affect performance (or justification should be self-evident).
-->
<details>
<summary>Checklist:</summary>
Completeness and readability
no changes to public API were made.
Testing
Failures in the internal CI do not look related to these changes.
No new functionality was introdiced.
Performance
n/a
</details>