Uh oh!
There was an error while loading. Please reload this page.
[SPARK-13852][YARN]handle the InterruptedException caused by YARN HA switch - #11692
[SPARK-13852][YARN]handle the InterruptedException caused by YARN HA switch#11692WangTaoTheTonic wants to merge 2 commits into
Conversation
SparkQA
commented
Mar 14, 2016
Test build #53060 has finished for PR 11692 at commit
|
| logError(s"Application $appId not found.") | ||
| return (YarnApplicationState.KILLED, FinalApplicationStatus.KILLED) | ||
| case NonFatal(e) => | ||
| if (e.isInstanceOf[InterruptedException] |
There was a problem hiding this comment.
Shouldn't these just be additional case statements above?
There was a problem hiding this comment.
we can only move InterruptedException to above but not exception caused by it.just move InterruptedException or leave these two here, which option do you think is better?
There was a problem hiding this comment.
Hm does this not work?
case e: InterruptedException => ...
case e: Exception if e.getCause.isInstanceOf[InterruptedException] => ...
There was a problem hiding this comment.
then the code segments will be seperated into two parts. i am not sure it's better.
There was a problem hiding this comment.
Ah sure, you can almost combine the two conditions with | in Scala but not quite in this case, but you can at least do ...
case e: Exception if e.isInstanceOf[InterruptedException] ||e.getCause.isInstanceOf[InterruptedException] =>
WangTaoTheTonic
commented
Mar 14, 2016
@srowen thanks for your comments. I've changed it, please check. |
SparkQA
commented
Mar 14, 2016
Test build #53072 has finished for PR 11692 at commit
|
srowen
commented
Mar 14, 2016
OK by me |
srowen
commented
Mar 15, 2016
@vanzin@jerryshao does that sound right? |
tgravescs
commented
Mar 15, 2016
@WangTaoTheTonic Can you please clarify exactly what is going on here? You are saying if YARN RM fails over from active to standby then our client logic can no longer connect to RM and gets an interrupted Exception? Who is interrupting the monitor thread? If its the spark context then how do you know its success and not failure? I'm not sure reporting success is the right thing to do here if we don't know the real status that is why I want to understand exactly what is going on. |
tgravescs
commented
Mar 15, 2016
Also which sleep are you referring to because the place you put the try/catch isn't around the Thread.sleep(interval) in monitorApplication, its only around getApplicationReport |
WangTaoTheTonic
commented
Mar 15, 2016
hi @tgravescs , it happened when sc stop normally in client mode. sc.stop will stop dagscheduler -> stop taskscheduler -> stop scheduler backend -> interrupt the monitor thread, in which it will enter into a retry logic where sleep intervals occurs(which is not the sleep here) waiting for RM's switching. The sleep methods will throw an InterruptedException when it is interrupted, so we need to catch it because it will log the application failed as treated as NonFatal(e), for now. |
WangTaoTheTonic
commented
Mar 15, 2016
for another concern about the final application status returned, we don't need too much worry as it is barely used by the codes who invoke this. |
tgravescs
commented
Mar 15, 2016
So you are saying that if spark context in yarn client mode is cleanly exiting while the RM is switching to the standby node, the call to getApplicationReport in Yarn can internally retry and sleep, since sc.stop() was called it ends up calling the scheduler backend stop interrupting the monitoring thread. The MonitorThread has a catch for interruptedException and should be printing an info message " Interrupting monitor thread", you are seeing this? Interrupted Exception is not a NonFatal error so it shouldn't be catching it: From scaladoc: |
tgravescs
commented
Mar 15, 2016
Also is this just what is being printed by the client or is the YARN final status (in RM) actually failed? |
WangTaoTheTonic
commented
Mar 15, 2016
I've only observed exception caused by InterruptedException but not itself directly, thought it should be wrapped internally. The status in RM is ok as it is decided by ApplicationMaster not spark client. In my recall i didn't see the message "Interrupting monitor thread" but not 100% sure. I will try to reproduce it and confirm. |
jerryshao
commented
Mar 16, 2016
@WangTaoTheTonic , would you please elaborate specific problem you met when From my understanding, it will only throw some exceptions mentioned that this application is failed, is that right? |
WangTaoTheTonic
commented
Mar 16, 2016
@tgravescs I reproduce it and the error message like:
There's no "Interrupting monitor thread" and the exception is UndeclaredThrowableException caused by InterruptedException. |
WangTaoTheTonic
commented
Mar 16, 2016
@jerryshao yes, the problem is that client side's log will throw exception and show app is failed. more details are in log i pasted. |
jerryshao
commented
Mar 16, 2016
But from my understanding, this exception does no harm to your application, since your application is about to finish itself, also this may happen occasionally. Also does it relate to RM HA, from my understanding, this |
WangTaoTheTonic
commented
Mar 16, 2016
the application is finished successfully(RM UI also show success state) but log shows it failed, that's the problem i think. yeah you're right sleep method can throw InterruptedException. this pr is trying to fix the problem we find in RM HA switching. what i am trying to say is that interrupting a monitor thread should not print the failed message in log. |
jerryshao
commented
Mar 16, 2016
I see your point, so the real issue should only be the log issue. But marking the state as
|
WangTaoTheTonic
commented
Mar 16, 2016
the added log just says "app is finished" but not "success". if sc stops because continuous stage failure, the returned |
tgravescs
commented
Mar 16, 2016
So inside of hadoop in the getApplicationReport call, it was in RetryInvocationHandler which was doing a sleep and got an interrupted exception. That ended up throwing a java.lang.reflect.UndeclaredThrowableException up to monitorApplication which is why it was handled by the NonFatal catch. I need to look at it a bit closer. |
WangTaoTheTonic
commented
Mar 18, 2016
so, how about it guys? |
tgravescs
commented
Mar 18, 2016
I have had time to look further to see what we should be doing, but as I read the exception you listed above, the fix you are proposing here won't work. Its not getting an InterruptedException back to the monitorApplication routine, its getting an UndeclaredThrowableException. |
WangTaoTheTonic
commented
Mar 19, 2016
have you tried to reproduce the scenaro and see what happend? The |
| case e: Exception if (e.isInstanceOf[InterruptedException] | ||
| || e.getCause.isInstanceOf[InterruptedException]) => | ||
| logInfo("The reporter thread is interrupted, we assume app is finished.") | ||
| return (YarnApplicationState.FINISHED, FinalApplicationStatus.SUCCEEDED) |
There was a problem hiding this comment.
how about we change the status to be UNDEFINED.
Since we really don't know the status it seems like returning the undefined in this case make more sense. Hopefully the user would then go look more at the RM or spark job details.
tgravescs
commented
Mar 22, 2016
sorry I didn't read the diff close enough thought you were just catching that type. I don't have an RM HA setup to quickly test it. I think there are cases this can return the wrong thing still (success when failure). Like if you control-c out of spark-shell during this same time period. Yes it probably doesn't make much difference, but at the same time I don't see it printing the exception to the log on shutdown as that big of a deal either. Is this actually causing you an issue or just annoying in the log? |
WangTaoTheTonic
commented
Mar 23, 2016
It will not impact on actuall result, but a error stacktrace and log showing failure will make user confused and easy to believe that the application is failed and needed to be submitted again. Like I said above, we return 2-tuple in which the last one ( |
vanzin
commented
Dec 5, 2016
Wow this is old. @WangTaoTheTonic I'm not sure this is the right fix. The code in YarnClientSchedulerBackend is already catching InterruptedException: It seems it just needs to be tweaked to also handled the |
Hi @vanzin, would this be then a soft-suggestion for closing this if there is no objection for about , way, a week? |
vanzin
commented
Feb 9, 2017
Either close or make the right fix. As it is, the PR is not doing the right thing. |
HyukjinKwon
commented
Feb 11, 2017
Let me try to propose to close this after a week if the author seems not active on this. |
## What changes were proposed in this pull request? This PR proposes to close stale PRs. What I mean by "stale" here includes that there are some review comments by reviewers but the author looks inactive without any answer to them more than a month. I left some comments roughly a week ago to ping and the author looks still inactive in these PR below These below includes some PR suggested to be closed and a PR against another branch which seems obviously inappropriate. Given the comments in the last three PRs below, they are probably worth being taken over by anyone who is interested in it. Closesapache#7963Closesapache#8374Closesapache#11192Closesapache#11374Closesapache#11692Closesapache#12243Closesapache#12583Closesapache#12620Closesapache#12675Closesapache#12697Closesapache#12800Closesapache#13715Closesapache#14266Closesapache#15053Closesapache#15159Closesapache#15209Closesapache#15264Closesapache#15267Closesapache#15871Closesapache#15861Closesapache#16319Closesapache#16324Closesapache#16890Closesapache#12398Closesapache#12933Closesapache#14517 ## How was this patch tested? N/A Author: hyukjinkwon <gurwls223@gmail.com> Closesapache#16937 from HyukjinKwon/stale-prs-close.
when sc stops, it will interrupt thread using to monitor app status.
the thread will throw an InterruptedException if YARN is switch as there is a sleep method in retry logic.
If YARN is switch between active and standby, sc.stop will return YarnApplicationState.FAILED as the InterruptedException is not caught.