Skip to content

[SPARK-1361] DAGScheduler throws NullPointerException occasionally - #429

Closed
scwf wants to merge 1 commit into
apache:masterfrom
scwf:dagnpe
Closed

scwf wants to merge 1 commit into
apache:masterfrom
scwf:dagnpe

Conversation

@scwf

@scwf scwf commented Apr 16, 2014

Copy link
Copy Markdown
Contributor

this is an order issue of construction and starting of the taskScheduler and the dagScheduler in SparkContext. now taskScheduler start before dagScheduler, so executor backend may register executor even before dagScheduler(or the eventProcessActor) has not initialized. in this situation it will throw NPE

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@andrewor14

Copy link
Copy Markdown
Contributor

I dug around in the code and in case anyone else is interested, the NPE is triggered by this line in DAGScheduler. This happens when the eventProcessActor is not yet initialized (i.e. dagScheduler.start() has not been called yet) by the time an executor is added.

@markhamstra

Copy link
Copy Markdown
Contributor

This has been previously discussed and is being fixed in #186

@andrewor14

Copy link
Copy Markdown
Contributor

It seems to me that this is a safe change, since all dagScheduler.start() does is create an actor that receives the messages in a separate thread, and the only source of events posted is from SparkContext (user code) or TaskSchedulerImpl (which happens only after task scheduler has started).

@andrewor14

Copy link
Copy Markdown
Contributor

Ah never mind, I didn't notice that PR.

@scwf scwf closed this Apr 27, 2014
@scwf
scwf deleted the dagnpe branch April 27, 2014 00:39
pwendell pushed a commit to pwendell/spark that referenced this pull request May 12, 2014
Add GraphX dependency to examples/pom.xml
andrewor14 pushed a commit to andrewor14/spark that referenced this pull request Jan 8, 2015
Add GraphX dependency to examples/pom.xml

(cherry picked from commit 193a075)
Signed-off-by: Reynold Xin <rxin@apache.org>
mccheah added a commit to mccheah/spark that referenced this pull request Nov 28, 2018
Because we use the mainline version now (and have been for awhile), not from the fork.
bzhaoopenstack pushed a commit to bzhaoopenstack/spark that referenced this pull request Sep 11, 2019
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Sep 26, 2026
…check

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

Task 212: a new kernel reaches the JIT on its first query. Task 195 (apache#429) found that a new shape's first query over a hundred thousand rows is slower on Varka than on vanilla, because the kernel is never compiled. This PR is the plan and its admission check, not the fix.

**The admission check refutes the obvious premise.** The first guess was the JIT's thresholds: a kernel is called once per batch, ten calls of about 625 iterations, short of every first-tier trigger. Scaling the thresholds down twentyfold and a hundredfold (`-XX:CompileThresholdScaling=0.05` and `0.01`) makes Varka's first run no faster, and at 0.01 slower. The JVM says why:

- **The time is in the kernel, interpreted.** A Java Flight Recorder run puts 69% of the executor threads' samples on an interpreted top frame; on the Varka arm those are the kernel's masked loop methods and the Vector API's boxing under them.
- **Compiling the kernel costs more than the query.** Recorded at 0.01, the kernel methods do compile, 1018 times over the run, and C2 - the only tier that runs the Vector API as vectors - takes 433.4 ms median per method, 902.3 at worst. A kernel at 54 entries has fourteen loop methods: several seconds of C2 time against a query of under one second. The query ends interpreted whatever the trigger.

**What that does to the design** (`PLAN_TASK_212.md` 9.2, proposed, for the owner to decide):

- Variant A, one kernel call per partition, cannot pay: an on-stack compile costs C2 the same time.
- Variant B survives, reshaped: a new shape's first batches run on Spark's row path while C2 compiles the kernel in the background, so the first query costs about what vanilla's does.
- A new lever: C2's compile time per kernel, starting with the masked loops, which the emitter's grouping multiplies.

The three results files are the two scaled runs and the compile summary from the recording. Row 212 joins the milestone table.

### Why are the changes needed?

The milestone's second post states the first-query cost as a bound, and the fix it needs is not the one the first measurement suggested.

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

No. A plan and its measurements.

### How was this patch tested?

The runs were on the quiet laptop with the canary passing, pinned as the committed cold-start run was, on apache#429's fixed benchmark. The quote check and the Varka pre-commit checks pass.

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

Generated-by: Claude Code (Claude Opus 5.5)
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.

4 participants