gc: order the per-thread sweep's index claim after the sweep setup #65318
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.38) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 148 lines diff across 1 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.299
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #65318"
general
weight: 0.35
Keno
A parallel collector thread does not have to act on a per-thread sweep request before the collection that issued it finishes, so it can enter
sweep_per_thread_loopduring a later collection and claim work from it. In that case the decrement ofgc_ptls_sweep_idxis the only thing ordering it after the thread that set up the sweep, but it was a relaxed operation, so the reads ofgc_all_tls_statesand of the other per-collection state that follow were not ordered after the writes they depend on.gc_sweep_big_seriallywas also evaluated before any index was claimed, so a late thread could use a stale answer and sweep the young big objects in parallel in a collection that sweeps them serially.Claim the index with an acquire operation (a new
jl_atomic_fetch_add_acquirewrapper), which pairs with the release store that publishes it, and evaluategc_sweep_big_seriallyonly once an index has been claimed.This was found by reading the code while looking at #65301 (fixed separately in #65314); I do not have a crash attributed to it.
This pull request was written with the assistance of generative AI.
🤖 Generated with Claude Code