Skip to content

[SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. - #1482

Closed
witgo wants to merge 1 commit into
apache:masterfrom
witgo:SPARK-2491
Closed

witgo wants to merge 1 commit into
apache:masterfrom
witgo:SPARK-2491

Conversation

@witgo

@witgo witgo commented Jul 18, 2014

Copy link
Copy Markdown
Contributor

No description provided.

@SparkQA

SparkQA commented Jul 18, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16823/consoleFull

@SparkQA

SparkQA commented Jul 18, 2014

Copy link
Copy Markdown

QA results for PR 1482:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16823/consoleFull

@SparkQA

SparkQA commented Jul 18, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16824/consoleFull

@witgo witgo changed the title SPARK-2491: Fix When an OOM is thrown,the executor does not stop properly. [WIP][SPARK-2491]: Fix When an OOM is thrown,the executor does not stop properly. Jul 18, 2014
@SparkQA

SparkQA commented Jul 18, 2014

Copy link
Copy Markdown

QA results for PR 1482:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16824/consoleFull

@SparkQA

SparkQA commented Jul 19, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16853/consoleFull

@SparkQA

SparkQA commented Jul 19, 2014

Copy link
Copy Markdown

QA results for PR 1482:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16853/consoleFull

@SparkQA

SparkQA commented Jul 19, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16854/consoleFull

@witgo witgo changed the title [WIP][SPARK-2491]: Fix When an OOM is thrown,the executor does not stop properly. [WIP][SPARK-2491][YARN]: Fix When an OOM is thrown,the executor does not stop properly. Jul 19, 2014
@witgo witgo changed the title [WIP][SPARK-2491][YARN]: Fix When an OOM is thrown,the executor does not stop properly. [SPARK-2491][YARN]: Fix When an OOM is thrown,the executor does not stop properly. Jul 26, 2014
@witgo witgo changed the title [SPARK-2491][YARN]: Fix When an OOM is thrown,the executor does not stop properly. [SPARK-2491]: Fix When an OOM is thrown,the executor does not stop properly. Jul 26, 2014
@witgo witgo changed the title [SPARK-2491]: Fix When an OOM is thrown,the executor does not stop properly. [SPARK-2491]: Fix When an fatal error is thrown,the executor does not stop properly. Jul 26, 2014
@JoshRosen

Copy link
Copy Markdown
Contributor

This seems reasonable to me. /cc @andrewor14 for another pair of eyes.

To recap some discussion on the JIRA, the issue that this addresses is a scenario where the Executor JVM is in the process of exiting due to an uncaught exception and other shutdown hooks might have deleted files or otherwise performed cleanup that causes other still-running tasks to fail. These additional failures/errors are confusing when they appear in the log and make it hard to find the real failure that caused the executor JVM to exit.

@witgo If I understand correctly, the problem here is that confusing messages appear in the logs, not that the executor doesn't stop or doesn't perform cleanup? If that's the case, can we edit the PR's title to "[SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown"?

@andrewor14

Copy link
Copy Markdown
Contributor

Just so I understand, by the time we enter this code block we would have already logged an OOM message, so it's confusing if we log more messages. Is that the main point of the PR?

However, I think this might have unforeseen consequences because the executor spends its last breath reporting its status and partial task metrics to the driver, and now it might not do this anymore. I'm not so sure if this is safe to do...

@JoshRosen

Copy link
Copy Markdown
Contributor

Here's my understanding of the flow of control that produced the original problem, as applied to this patch:

A task throws an uncaught exception (let's say OutOfMemoryError). This is caught by the case t: Throwable block. If this is the first task to fail with a Throwable, then Utils.inShutdown() should return false because no shutdown hook will be running. If this Throwable indicates a fatal error, then that thread runs ExecutorUncaughtExceptionHandler.uncaughtException(t). That handler calls System.exit(), which begins running the shutdown hooks.

While the shutdown hook is running, it might delete files or other resources needed by other tasks that are still running. When these secondary errors occur, they are caught by the same case t: Throwable case, except this time Utils.inShutdown() might return True, causing the exception to be ignored.

I suppose we could add an else clause that logs a note when we're suppressing exceptions.

Anyhow, I think that we'll still report the partial task metrics, etc. but only as of the time at the first task fails. Prior to this patch, we might attempt to send multiple metrics and status updates from the secondary failures caused by the shutdown.

@witgo witgo changed the title [SPARK-2491]: Fix When an fatal error is thrown,the executor does not stop properly. [SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. Sep 6, 2014
@JoshRosen

Copy link
Copy Markdown
Contributor

Jenkins, retest this please.

@SparkQA

SparkQA commented Sep 6, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482 at commit 6673dca.

  • This patch merges cleanly.

@aarondav

aarondav commented Sep 6, 2014

Copy link
Copy Markdown
Contributor

Could this suppress the OOM message from getting to the driver? I thought there was special handling for these messages (error code). This could result in "executor died" rather than "executor oom'd" messages.

@SparkQA

SparkQA commented Sep 6, 2014

Copy link
Copy Markdown

QA tests have finished for PR 1482 at commit 6673dca.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@JoshRosen

Copy link
Copy Markdown
Contributor

@aarondav Do you have an example scenario where this patch prevents OOM reporting? Really, the only change here is wrapping the exception logging / reporting with if (!Utils.inShutdown()), which should always return false until we have a fatal error that triggers the shutdown. The actual handling the fatal error itself should be the same, as far as I can tell.

@aarondav

aarondav commented Sep 9, 2014

Copy link
Copy Markdown
Contributor

Well, I mean, this is our attempt to tell people what happened:

execBackend.statusUpdate(taskId, TaskState.FAILED, ser.serialize(reason))

We cannot expect that this logic was already called once, I believe, because the executor may enter shutdown mode based on a different thread receiving an OOM.

@witgo

witgo commented Sep 9, 2014

Copy link
Copy Markdown
Contributor Author

@aarondav I understand what you mean,I will submit the relevant code tomorrow.
BTW,most of the OOM are present in deserialization process.

@witgo witgo changed the title [SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. [WIP][SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. Sep 9, 2014
@witgo
witgo force-pushed the SPARK-2491 branch 2 times, most recently from 26bb8dc to 48d73ae Compare September 10, 2014 15:26
@SparkQA

SparkQA commented Sep 10, 2014

Copy link
Copy Markdown

QA tests have started for PR 1482 at commit 48d73ae.

  • This patch merges cleanly.

@SparkQA

SparkQA commented Sep 10, 2014

Copy link
Copy Markdown

QA tests have finished for PR 1482 at commit 48d73ae.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(

@JoshRosen

Copy link
Copy Markdown
Contributor

@aarondav Ah, I see your point: an OOM might be thrown from anywhere and hit the uncaught exception handler via a different code path.

@witgo witgo changed the title [WIP][SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. [SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. Oct 22, 2014
@SparkQA

SparkQA commented Nov 1, 2014

Copy link
Copy Markdown

Test build #22693 has finished for PR 1482 at commit 996f67d.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(
    • class StreamingKMeansModel(
    • class StreamingKMeans(

@witgo

witgo commented Nov 1, 2014

Copy link
Copy Markdown
Contributor Author

Jenkins, retest this please.

@SparkQA

SparkQA commented Nov 1, 2014

Copy link
Copy Markdown

Test build #22694 has finished for PR 1482 at commit 996f67d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(

@SparkQA

SparkQA commented Dec 22, 2014

Copy link
Copy Markdown

Test build #24695 has finished for PR 1482 at commit cfe98b8.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(

@SparkQA

SparkQA commented Mar 23, 2015

Copy link
Copy Markdown

Test build #28980 has finished for PR 1482 at commit 68a5086.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(

@ilganeli

Copy link
Copy Markdown

@JoshRosen There's been no activity here for over 5 months - is this still alive? If not, I wouldn't mind finishing the job since I ran into this exact issue and could use better debug visibility.

@JoshRosen

Copy link
Copy Markdown
Contributor

@ilganeli I think that this has largely stalled because this is a somewhat complicated-to-review change (as the discussion above shows, it can be tricky to make sure that we've thought through all of the ways in which control can enter the error-handling / shutdown hook code). This issue is probably still worth fixing, but I think it will take a lot more work to review this, especially since this type of code is hard to test.

@ilganeli

Copy link
Copy Markdown

I actually wouldn't mind working on this - it's an issue near and dear to my heart :-). What's the best way to pick up the ball here ? I could just make a new PR - the changes are pretty minimal at present.

Sent with Good (www.good.com)

-----Original Message-----
From: Josh Rosen [notifications@github.commailto:notifications@github.com]
Sent: Saturday, April 18, 2015 08:05 PM Eastern Standard Time
To: apache/spark
Cc: Ganelin, Ilya
Subject: Re: [spark] [SPARK-2491] Don't handle uncaught exceptions from tasks that fail during executor shutdown. (#1482)

@ilganelihttps://github.com/ilganeli I think that this has largely stalled because this is a somewhat complicated-to-review change (as the discussion above shows, it can be tricky to make sure that we've thought through all of the ways in which control can enter the error-handling / shutdown hook code). This issue is probably still worth fixing, but I think it will take a lot more work to review this, especially since this type of code is hard to test.

—
Reply to this email directly or view it on GitHubhttps://github.com//pull/1482#issuecomment-94215242.


The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

@SparkQA

SparkQA commented Apr 22, 2015

Copy link
Copy Markdown

Test build #30738 has finished for PR 1482 at commit 84ea436.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(
  • This patch does not change any dependencies.

@witgo

witgo commented Apr 22, 2015

Copy link
Copy Markdown
Contributor Author

Jenkins, retest this please.

@SparkQA

SparkQA commented Apr 22, 2015

Copy link
Copy Markdown

Test build #30750 has finished for PR 1482 at commit 84ea436.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(
  • This patch does not change any dependencies.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this doesn't change what was there before, but is this safe during shutdown?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, Here are just thrown a ExecutorExitFailure (not ExceptionFailure) . The code work in most cases.

@vanzin

vanzin commented Apr 29, 2015

Copy link
Copy Markdown
Contributor

Well, this has been lingering here for a while. Looks sane though.

@SparkQA

SparkQA commented Apr 30, 2015

Copy link
Copy Markdown

Test build #31427 has finished for PR 1482 at commit ac022c9.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(
  • This patch does not change any dependencies.

@andrewor14

Copy link
Copy Markdown
Contributor

What's the status of this patch? Is it still relevant after so many releases? @witgo @vanzin

@witgo

witgo commented Sep 2, 2015

Copy link
Copy Markdown
Contributor Author

I think it is necessary to merge the PR into master.

@SparkQA

SparkQA commented Sep 2, 2015

Copy link
Copy Markdown

Test build #41928 has finished for PR 1482 at commit 7271308.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class ExecutorExitFailure(

@nssalian

nssalian commented Nov 3, 2015

Copy link
Copy Markdown

What is the status of the PR? Seems no movement for a while. @vanzin

@srowen

srowen commented Nov 3, 2015

Copy link
Copy Markdown
Member

Do you mind closing this PR?

@witgo witgo closed this Nov 4, 2015
@witgo
witgo deleted the SPARK-2491 branch November 4, 2015 03:30
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 25, 2026
…apache#1709)

* [VARKA] Plan: correct rows 103, 351 and 414 for merged upstream fixes

Three plan records describe Spark as it was before upstream fixes that are
merged now. SPARK-60743 (on master since apache#1482) ended the int narrowing of the
six-field make_timestamp_ntz's seconds that VARKA-351 planned to copy, and
answered its upstream-filing flag. SPARK-60746 (since apache#1427) made the two
error classes of dt / -1 one, which VARKA-103 still described. SPARK-61352
merged upstream on 24 November 2026: VARKA-414 gave its pull request's old
title and a copyTagsFrom rule that runs the other way from the merged one, as
upstream's tests show, and named two of the three declines left to lift.
Row 351's PLAN.md line is left alone, since apache#1707 edits the adjacent row 350.

Generated-by: Claude Code (Claude Opus 5.5)

* [VARKA] Plan: fix the review findings on the upstream-fix corrections

Row 351's PLAN.md line now carries its own correction, as the change that
produces it should, and VARKA-351's open point about leaving it is dropped.
VARKA-351 2.6 states that the bad-field mask takes precedence over the micros
sum's FAIL, since without the narrowing a bad lane's seconds can make the sum
overflow where Spark rejects the fields first, and names the test for it; the
TRY form's NULL now cites the golden files that show it. The debt register
entry and row 414 record what SPARK-61352's merge leaves to close. VARKA-103
says the first of item 8's facts was refuted rather than settled, cites
IntervalMathUtils.divide's current overloads and marks its older line
citations as pre-SPARK-60746. VARKA-414 gives SPARK-61352's branch-4.x and
release-branch commits.

Generated-by: Claude Code (Claude Opus 5.5)

---------

Co-authored-by: t <t@example.com>
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.

9 participants