Skip to content

[SPARK-59253][UDF] Fix direct dispatcher interrupt race - #58525

Open
haiyangsun-db wants to merge 1 commit into
apache:masterfrom
haiyangsun-db:fix-direct-worker-interrupt-race
Open

[SPARK-59253][UDF] Fix direct dispatcher interrupt race#58525
haiyangsun-db wants to merge 1 commit into
apache:masterfrom
haiyangsun-db:fix-direct-worker-interrupt-race

Conversation

@haiyangsun-db

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Capture and clear an interrupt that races with lifecycle notification in
DirectWorkerDispatcher.awaitInFlightOperations().

The interrupt is checked after leaving the lifecycleLock.synchronized block.
Thread.interrupted() is evaluated first so the interrupt flag is always
cleared. close() restores the interrupt after cleanup completes.

Why are the changes needed?

lifecycleLock.wait() may return normally after notification while an
overlapping interrupt leaves the thread's interrupt flag set. Subsequent
cleanup may then fail with InterruptedException before it completes.

Does this PR introduce any user-facing change?

No. The affected UDF worker functionality is unreleased and experimental.

How was this patch tested?

The existing regression test passed 40 consecutive runs:

DirectWorkerDispatcherSuite: interrupted close completes cleanup before restoring the interrupt

The full DirectWorkerDispatcherSuite also passed with all 34 tests successful.

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

Yes.

Capture and clear an interrupt that races with lifecycle notification so dispatcher cleanup completes before close restores the interrupt status.
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.

1 participant