Skip to content

[AURON #2107] Fix driver spill NPE error#2108

Open
Deegue wants to merge 1 commit intoapache:masterfrom
Deegue:auron_#2107
Open

[AURON #2107] Fix driver spill NPE error#2108
Deegue wants to merge 1 commit intoapache:masterfrom
Deegue:auron_#2107

Conversation

@Deegue
Copy link

@Deegue Deegue commented Mar 19, 2026

Which issue does this PR close?

Closes #2107

Rationale for this change

When SparkOnHeapSpillManager.current is called on the driver side, TaskContext.get returns null, causing a NPE.

What changes are included in this PR?

Add a null check when TaskContext is unavailable.
Update the JNI bridge SIG_TYPE to resolve methods against the OnHeapSpillManager.

Are there any user-facing changes?

No.

How was this patch tested?

UT

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a driver-side null dereference when resolving the current on-heap spill manager in Spark, and aligns the JNI bridge to resolve spill methods against the shared OnHeapSpillManager interface so calls work for all implementations (including the disabled manager).

Changes:

  • Add a null check in SparkOnHeapSpillManager.current to avoid NPE when TaskContext.get is unavailable (driver-side).
  • Update the JNI bridge class signature for spill manager method resolution to org/apache/auron/memory/OnHeapSpillManager.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
spark-extension/src/main/scala/org/apache/spark/sql/auron/memory/SparkOnHeapSpillManager.scala Prevents driver-side NPE by returning a disabled spill manager when TaskContext is null.
native-engine/auron-jni-bridge/src/jni_bridge.rs Resolves JNI method IDs against the OnHeapSpillManager interface for compatibility across implementations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +198 to +202
if (tc != null) {
all.getOrElseUpdate(tc.taskAttemptId(), new SparkOnHeapSpillManager(tc))
} else {
OnHeapSpillManager.getDisabledOnHeapSpillManager
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnHeapSpillManager.getDisabledOnHeapSpillManager() creates a new anonymous instance on each call (see auron-core/.../OnHeapSpillManager.java). Since current may be called repeatedly on the driver (where TaskContext.get == null), consider caching a single disabled manager instance in SparkOnHeapSpillManager (e.g., a private val) and returning that to avoid unnecessary allocations/GC churn.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix driver spill NPE error

3 participants