Uh oh!
There was an error while loading. Please reload this page.
[SPARK-19147][CORE] Gracefully handle error in task after executor is stopped - #25759
[SPARK-19147][CORE] Gracefully handle error in task after executor is stopped#25759colinmjj wants to merge 1 commit into
Conversation
srowen
commented
Sep 11, 2019
Wait, why would we be creating a new client after the executor is shut down? |
colinmjj
commented
Sep 12, 2019
Here is the scene, when the executor is killed before shuffle process, but the task was created and ready to fetch blocks. Then, the NPE will occur if task try to create a new client. |
There was a problem hiding this comment.
This is still going to generate an exception in the logs, no? should it just be a log warning?
This is I think too indirect. Why not throw IllegalStateException in createClient instead in this case and catch for it specifically?
srowen
commented
Sep 12, 2019
Also please improve the title of this PR |
colinmjj
commented
Sep 13, 2019
@srowen thanks for the comments, I'll update the pr later. |
HyukjinKwon
commented
Sep 16, 2019
@colinmjj, also please fill other items in PR description. |
SparkQA
commented
Sep 16, 2019
Test build #4871 has finished for PR 25759 at commit
|
colinmjj
commented
Sep 17, 2019
@srowen The patch is updated, for the exception from task after executor.stop, add exception process to deal with it. |
There was a problem hiding this comment.
Why not just catch NullPointerException and ignore it?
But, maybe createClient should throw a better exception to begin with?
There was a problem hiding this comment.
The test shows exception is occurred if TransportClientFactory.createClient() called after TransportClientFactory.close().
Agree to throw a better exception and the patch is updated. There should be an IOException now.
There was a problem hiding this comment.
CC @jerryshao or @squito perhaps
My question is, if the executor is shut down, can you even report metrics etc, or is it meaningful?
There was a problem hiding this comment.
you might succeed, as this will race against the stopping the executor. But you're very likely to trigger more exceptions from execBackend.statusUpdate, so it probably doesn't make sense to try, especially if the whole point of this change is to cut down on scary error msgs during shutdown.
btw I think env.isStopped will need to be volatile for this to work reliably.
There was a problem hiding this comment.
@srowen@squito , thanks for the comments, I check the code again and make clearly how metrics & heartbeat work. You're right, report metrics is meaningless after executor.close(), because heartbeat won't work.
Update the pr and the exception will be processed in "case t: Throwable =>" part with log only.
There was a problem hiding this comment.
The purpose of the change is really to avoid stack traces, not assert about the particular error. Would this pass even before this change? I'm just wondering if this is worth testing.
What may be worth testing is whether metrics are updated, which is the real possible behavior change here? or would they already be reported in case of an error?
There was a problem hiding this comment.
Remove the case after I make clearly how metrics works, thanks for review.
There was a problem hiding this comment.
This is looking OK overall, to me. You might be able to avoid most of the diff due to indentation by only adding a single case:
case t: Throwable if env.isStopped =>
logError(...)
case t: Throwable =>
// unchanged
SparkQA
commented
Sep 19, 2019
Test build #4876 has finished for PR 25759 at commit
|
srowen
commented
Sep 21, 2019
Merged to master |
dongjoon-hyun
commented
Sep 21, 2019
Hi, All. |
srowen
commented
Sep 21, 2019
Although it's 'just' a cosmetic issue with how errors are logged in a sort of corner case, it's also a minor change. I'm fine if you want to back-port to 2.4. |
dongjoon-hyun
commented
Sep 21, 2019
Thanks, @srowen . I'll backport this to branch-2.4. |
… stopped ### What changes were proposed in this pull request? TransportClientFactory.createClient() is called by task and TransportClientFactory.close() is called by executor. When stop the executor, close() will set workerGroup = null, NPE will occur in createClient which generate many exception in log. For exception occurs after close(), treated it as an expected Exception and transform it to InterruptedException which can be processed by Executor. ### Why are the changes needed? The change can reduce the exception stack trace in log file, and user won't be confused by these excepted exception. ### Does this PR introduce any user-facing change? N/A ### How was this patch tested? New tests are added in TransportClientFactorySuite and ExecutorSuite Closes#25759 from colinmjj/spark-19147. Authored-by: colinma <colinma@tencent.com> Signed-off-by: Sean Owen <sean.owen@databricks.com> (cherry picked from commit 076186e) Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
What changes were proposed in this pull request?
TransportClientFactory.createClient() is called by task and TransportClientFactory.close() is called by executor.
When stop the executor, close() will set workerGroup = null, NPE will occur in createClient which generate many exception in log.
For exception occurs after close(), treated it as an expected Exception
and transform it to InterruptedException which can be processed by Executor.
Why are the changes needed?
The change can reduce the exception stack trace in log file, and user won't be confused by these excepted exception.
Does this PR introduce any user-facing change?
N/A
How was this patch tested?
New tests are added in TransportClientFactorySuite and ExecutorSuite