[SPARK-58322][CORE] Verify executor app ID matches driver at config fetch#57525
Open
wangyum wants to merge 1 commit into
Open
[SPARK-58322][CORE] Verify executor app ID matches driver at config fetch#57525wangyum wants to merge 1 commit into
wangyum wants to merge 1 commit into
Conversation
uros-b
approved these changes
Jul 26, 2026
Member
|
Thank you @wangyum! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR adds an executor-side app-ID verification that runs immediately after the executor fetches the driver's Spark config via
RetrieveSparkAppConfig, beforeSparkEnvis created. The newCoarseGrainedExecutorBackend.verifyAppIdcompares the executor's--app-idlaunch argument (assigned by the cluster manager) againstspark.app.idfrom the driver'sSparkConf(set inSparkContext), and throwsSparkExceptionon mismatch.The check is invoked in both code paths that retrieve the driver config:
CoarseGrainedExecutorBackend.run()— covers Standalone and YARN (YARN delegates to the sharedrun()viaYarnCoarseGrainedExecutorBackend).KubernetesExecutorBackend.run()— separate implementation, so the call is added there explicitly.The verification is unconditional (always on). It only fires when
spark.app.idis present in the driver properties and differs from the executor's app ID — a condition that never occurs in normal operation.Why are the changes needed?
When a driver hits a fatal error (e.g., OOM) that kills the RPC dispatcher thread,
SparkContext.stop()releases the driver's RPC port while the driver process (and in YARN cluster mode, the ApplicationMaster) can remain in a zombie state — still heartbeating to the resource manager but effectively dead. During this window, the freed port can be rebound by another driver on the same host, and newly launched executors can connect to the wrong driver and register to the wrong application, risking data corruption.Does this PR introduce any user-facing change?
Yes. In the rare case of an app-ID mismatch, the executor will now exit immediately at startup with a
SparkExceptioninstead of registering to the wrong driver. The error message is:No config or API changes. No impact on normal operation.
How was this patch tested?
Unit tests.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: GLM 5.2.