[SPARK-54796][CORE] Fix NPE caused by race condition between Executor initialization and shuffle migration #54136
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 213 lines diff across 2 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.321
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #54136"
general
weight: 0.35
Ngone51
What changes were proposed in this pull request?
Fixing the race condition between executor initialization and shuffle migration. When starting an
Executor, spark will:Shuffle migration request could be received before shuffle manager is initialized,
putBlockDataAsStreamwill be invoked and shuffleManager will be initialized asnull.Then all the later operations depending on
shuffleManagerwill fail withNPE.To fix the issue, this PR propose to:
1. Check whether shuffleManager is initialized when in
putBlockDataAsStreamwhich could be called before the Executor is fully ready to handle migration requests.2. If not ready, will wait until the specified timeout exceeds.
3. The
BlockManagerDecommissionerwill retry if the shuffle migration request hits the issue timeout waiting for shuffleManager to be initialized.Why are the changes needed?
Fixing the race condition leading to the
shuffleManagerin BlockManager to be initialized asnull.Does this PR introduce _any_ user-facing change?
No
How was this patch tested?
UT added.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Cursor 2.4.23