Skip to content

[SPARK-56539][CORE] Fix zero exit code on Standalone remote driver failure#56736

Open
arham0254A wants to merge 1 commit into
apache:masterfrom
arham0254A:fix-standalone-exit-code
Open

[SPARK-56539][CORE] Fix zero exit code on Standalone remote driver failure#56736
arham0254A wants to merge 1 commit into
apache:masterfrom
arham0254A:fix-standalone-exit-code

Conversation

@arham0254A

Copy link
Copy Markdown

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

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