- Launcher is launching the AppAttempt, (line#2 below code)
try {
launch();
handler.handle(new RMAppAttemptEvent(application.getAppAttemptId(),
RMAppAttemptEventType.LAUNCHED, System.currentTimeMillis()));
} catch(Exception ie) {
onAMLaunchFailed(masterContainer.getId(), ie);
}
}- Shutdown command is sent to NM who holds the container, so launch get exception.
- Recovery process will send KILL event to AppAttempt, and the state change to FAILED
- Then Launcher will send LAUNCH_FAILED event to RMContainer( in code#6)(PS, onAMLaunchFailed is written by me,:joy:)
- but it can't handle this event at KILLED state.
private void launch() throws IOException, YarnException {
connect();
ContainerId masterContainerID = masterContainer.getId();
}
- Crash timing is very important to trigger this bug.
- As above code show, connect() will check whether the node is live, if not , exception will be thrown and bug won't be triggered.
- line 3 is read operation, so CrashTuner will inject shutdown command between line#2 and line#3.
- Hence the bug is triggered.
- The sleep after shutdown is very important to flip the KILL event and LAUNCH_FAILED event.
pre-read
org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncher launch 132
