[core] Make TStorage::fgMaxBlockSize updates atomic #24447
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 227 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 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
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.325
Real PR Conversation Timeline
1 comments
"Review active on #24447"
general
weight: 0.35
pcanal
This Pull request:
Changes or fixes:
In multithreaded programs linked with
libNew,TStorage::EnterStatand the#ifndef MEM_STATfallback inNewDelete.cxxupdated the staticTStorage::fgMaxBlockSizevia an unsynchronized read-modify-write (SetMaxBlockSize(max(GetMaxBlockSize(), size))). A concurrent smaller allocation could overwrite a larger maximum recorded by another thread, causingCheckFreeSizeinoperator deleteto abort withunreasonable sizein addition to being a data race.This PR makes
TStorage::fgMaxBlockSizeastd::atomic<size_t>, introducesTStorage::UpdateMaxBlockSize(size_t)using a monotoniccompare_exchange_weakloop so the recorded maximum can never decrease under concurrent allocations (and smaller allocations avoid unnecessary writes), switches bothEnterStatcall sites to it, and adds a concurrent unit test incore/base/test/TStorageTests.cxx.Local testing note: verified via a standalone harness compiling
core/base/src/TStorage.cxxand running the concurrent test logic (reproducing lost updates under-O2and data races under-fsanitize=threadbefore the change, and confirming 0 lost updates and 0 ThreadSanitizer warnings after), syntax-checkedNewDelete.cxxandTStorageTests.cxxwith-Wall -Wextra, and verified formatting against.clang-formatwithgit-clang-format. (A full ROOT CMake build was not run locally.)AI-assisted coding disclosure:
An AI coding assistant (Antigravity) was used to assist with investigating #24438, drafting the patch and unit test, and preparing the commit message and PR description. I have reviewed, understood, and verified all changes locally and take full responsibility for them.
Checklist:
This PR fixes #24438