Skip to content

[SPARK-56773][CORE][TESTS][FOLLOWUP] Always allocate INJECT_SHUFFLE_FETCH_FAILURES injection maps#56631

Open
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:SPARK-56773-followup
Open

[SPARK-56773][CORE][TESTS][FOLLOWUP] Always allocate INJECT_SHUFFLE_FETCH_FAILURES injection maps#56631
cloud-fan wants to merge 1 commit into
apache:masterfrom
cloud-fan:SPARK-56773-followup

Conversation

@cloud-fan

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Followup to #55738.

The three INJECT_SHUFFLE_FETCH_FAILURES injection-state maps in DAGScheduler (injectShuffleFetchFailuresCorruptedAttempt, injectShuffleFetchFailuresPendingDelayedCorruption, injectShuffleFetchFailuresDownstreamSuccessCount) are initialized with if (Utils.isTesting) new ConcurrentHashMap else null. This patch allocates them unconditionally instead.

Why are the changes needed?

The cleanup site in cleanupStateForJobAndIndependentStages (and the other use-sites) re-evaluate if (Utils.isTesting) to decide whether to dereference these maps. Utils.isTesting reads the mutable spark.testing system property, so it can return a different value when the DAGScheduler is constructed than at the later use-sites. If it does, a null map is dereferenced and the DAGScheduler event loop crashes with a NullPointerException. Allocating the maps unconditionally makes the construction guard and the use-site guards consistent, so they can never disagree.

Does this PR introduce any user-facing change?

No. The maps are only ever populated inside the config-gated INJECT_SHUFFLE_FETCH_FAILURES test paths, so in production they stay empty and there is no behavioral change beyond allocating an empty map.

How was this patch tested?

Existing tests. This is a defensive initialization change; the maps stay empty unless the existing INJECT_SHUFFLE_FETCH_FAILURES test paths populate them, so the existing coverage exercises them unchanged.

Was this patch authored or co-authored using generative AI tooling?

Yes, drafted with Claude Code (Anthropic).

…ETCH_FAILURES injection maps

### What changes were proposed in this pull request?

Followup to apache#55738.

The three `INJECT_SHUFFLE_FETCH_FAILURES` injection-state maps in `DAGScheduler`
(`injectShuffleFetchFailuresCorruptedAttempt`,
`injectShuffleFetchFailuresPendingDelayedCorruption`,
`injectShuffleFetchFailuresDownstreamSuccessCount`) are initialized with
`if (Utils.isTesting) new ConcurrentHashMap else null`. This patch allocates them
unconditionally instead.

### Why are the changes needed?

The cleanup site in `cleanupStateForJobAndIndependentStages` (and the other
use-sites) re-evaluate `if (Utils.isTesting)` to decide whether to dereference
these maps. `Utils.isTesting` reads the mutable `spark.testing` system property,
so it can return a different value when the `DAGScheduler` is constructed than at
the later use-sites. If it does, a `null` map is dereferenced and the
`DAGScheduler` event loop crashes with a `NullPointerException`. Allocating the
maps unconditionally makes the construction guard and the use-site guards
consistent, so they can never disagree.

### Does this PR introduce _any_ user-facing change?

No. The maps are only ever populated inside the config-gated
`INJECT_SHUFFLE_FETCH_FAILURES` test paths, so in production they stay empty and
there is no behavioral change beyond allocating an empty map.

### How was this patch tested?

Existing tests. This is a defensive initialization change; the maps stay empty
unless the existing `INJECT_SHUFFLE_FETCH_FAILURES` test paths populate them, so
the existing coverage exercises them unchanged.

### Was this patch authored or co-authored using generative AI tooling?

Yes, drafted with Claude Code (Anthropic).
@cloud-fan

Copy link
Copy Markdown
Contributor Author

cc @juliuszsompolski

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants