YARN-8629. Container cleanup fails while trying to delete Cgroups. (Suma Shivaprasad via wangda)

Change-Id: I392ef4f8baa84d5d7b1f2e438c560b5426b6d4f2
This commit is contained in:
Wangda Tan 2018-08-07 12:36:55 -07:00
parent b1a59b1644
commit d4258fcad7

View File

@ -504,6 +504,7 @@ private void logLineFromTasksFile(File cgf) {
private boolean checkAndDeleteCgroup(File cgf) throws InterruptedException { private boolean checkAndDeleteCgroup(File cgf) throws InterruptedException {
boolean deleted = false; boolean deleted = false;
// FileInputStream in = null; // FileInputStream in = null;
if ( cgf.exists() ) {
try (FileInputStream in = new FileInputStream(cgf + "/tasks")) { try (FileInputStream in = new FileInputStream(cgf + "/tasks")) {
if (in.read() == -1) { if (in.read() == -1) {
/* /*
@ -522,6 +523,11 @@ private boolean checkAndDeleteCgroup(File cgf) throws InterruptedException {
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failed to read cgroup tasks file. ", e); LOG.warn("Failed to read cgroup tasks file. ", e);
} }
} else {
LOG.info("Parent Cgroups directory {} does not exist. Skipping "
+ "deletion", cgf.getPath());
deleted = true;
}
return deleted; return deleted;
} }