-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YARN-6061. Add a customized uncaughtexceptionhandler for critical threads #182
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ce2b20a
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain c053b99
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain db29207
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain 1abba7d
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain c9d2057
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain cd06410
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain 5d36c5f
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain 8b3da60
YARN-6061. Add a customized uncaughtexceptionhandler for critical thr…
flyrain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -824,25 +824,29 @@ public void handle(RMFatalEvent event) { | |
* Transition to standby in a new thread. | ||
*/ | ||
public void handleTransitionToStandByInNewThread() { | ||
new Thread() { | ||
@Override | ||
public void run() { | ||
if (rmContext.isHAEnabled()) { | ||
try { | ||
// Transition to standby and reinit active services | ||
LOG.info("Transitioning RM to Standby mode"); | ||
transitionToStandby(true); | ||
EmbeddedElector elector = rmContext.getLeaderElectorService(); | ||
if (elector != null) { | ||
elector.rejoinElection(); | ||
} | ||
} catch (Exception e) { | ||
LOG.fatal("Failed to transition RM to Standby mode.", e); | ||
ExitUtil.terminate(1, e); | ||
Thread standByTransitionThread = new Thread(new StandByTransitionThread()); | ||
standByTransitionThread.setName("StandByTransitionThread Handler"); | ||
standByTransitionThread.start(); | ||
} | ||
|
||
private class StandByTransitionThread implements Runnable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naming the Runnable a Thread sounds confusing. Can we change it to TransitionToStandbyRunnable or some such? |
||
@Override | ||
public void run() { | ||
if (rmContext.isHAEnabled()) { | ||
try { | ||
// Transition to standby and reinit active services | ||
LOG.info("Transitioning RM to Standby mode"); | ||
transitionToStandby(true); | ||
EmbeddedElector elector = rmContext.getLeaderElectorService(); | ||
if (elector != null) { | ||
elector.rejoinElection(); | ||
} | ||
} catch (Exception e) { | ||
LOG.fatal("Failed to transition RM to Standby mode.", e); | ||
ExitUtil.terminate(1, e); | ||
} | ||
} | ||
}.start(); | ||
} | ||
} | ||
|
||
@Private | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not identifying this earlier. We should make this thread-safe in case this is triggered by two critical threads failing at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, would it make sense to create an instance of the Runnable on transition to active, and start a new thread on a need-to basis. If all threads use a single instance of the Runnable, may be it is easier to coordinate?