[SPARK-56539][CORE] Fix zero exit code on Standalone remote driver failure#56736
Open
arham0254A wants to merge 1 commit into
Open
[SPARK-56539][CORE] Fix zero exit code on Standalone remote driver failure#56736arham0254A wants to merge 1 commit into
arham0254A wants to merge 1 commit into
Conversation
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 modifies the reportDriverStatus method within the Standalone ClientEndpoint to properly map remote driver failure states to a non-zero OS exit code when spark.standalone.submit.waitAppCompletion=true.
Previously, the JVM shutdown sequence was unconditionally calling System.exit(0) for all terminal driver states (FINISHED, FAILED, ERROR, KILLED). This PR decouples the success state from the failure states, ensuring that FAILED, ERROR, and KILLED trigger a System.exit(-1) and log an error rather than an info message.
Why are the changes needed?
When users submit jobs to a Standalone cluster using --conf spark.standalone.submit.waitAppCompletion=true, the local client is expected to mirror the final execution state of the remote driver. As demonstrated by the issue reporter, when wrapping spark-submit in a Bash script and evaluating the OS exit code via $?, the script incorrectly evaluates to 0 (success) despite the client acknowledging a FAILED remote driver state.
Because the client was swallowing the remote failure, external orchestration tools (like Apache Airflow, Jenkins, or standard Bash scripts) were falsely interpreting crashed jobs as successful, leading to silent pipeline failures.
Does this PR introduce any user-facing change?
Yes. Users running spark-submit in Standalone cluster mode with waitAppCompletion=true will now correctly receive a non-zero exit code (-1) in their local terminal/OS if the remote driver fails, errors out, or is killed.
How was this patch tested?
Relying on existing CI integration test suites for Standalone cluster submission and endpoint state handling.
Was this patch authored or co-authored using generative AI tooling?
Yes the documentation of PR and initial error find in the terminal of issue reporter was Generated by: Google Gemini