YARN-8629. Container cleanup fails while trying to delete Cgroups. (Suma Shivaprasad via wangda)
Change-Id: I392ef4f8baa84d5d7b1f2e438c560b5426b6d4f2
This commit is contained in:
parent
b1a59b1644
commit
d4258fcad7
@ -504,23 +504,29 @@ 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;
|
||||||
try (FileInputStream in = new FileInputStream(cgf + "/tasks")) {
|
if ( cgf.exists() ) {
|
||||||
if (in.read() == -1) {
|
try (FileInputStream in = new FileInputStream(cgf + "/tasks")) {
|
||||||
|
if (in.read() == -1) {
|
||||||
/*
|
/*
|
||||||
* "tasks" file is empty, sleep a bit more and then try to delete the
|
* "tasks" file is empty, sleep a bit more and then try to delete the
|
||||||
* cgroup. Some versions of linux will occasionally panic due to a race
|
* cgroup. Some versions of linux will occasionally panic due to a race
|
||||||
* condition in this area, hence the paranoia.
|
* condition in this area, hence the paranoia.
|
||||||
*/
|
*/
|
||||||
Thread.sleep(deleteCGroupDelay);
|
Thread.sleep(deleteCGroupDelay);
|
||||||
deleted = cgf.delete();
|
deleted = cgf.delete();
|
||||||
if (!deleted) {
|
if (!deleted) {
|
||||||
LOG.warn("Failed attempt to delete cgroup: " + cgf);
|
LOG.warn("Failed attempt to delete cgroup: " + cgf);
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
logLineFromTasksFile(cgf);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (IOException e) {
|
||||||
logLineFromTasksFile(cgf);
|
LOG.warn("Failed to read cgroup tasks file. ", e);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} else {
|
||||||
LOG.warn("Failed to read cgroup tasks file. ", e);
|
LOG.info("Parent Cgroups directory {} does not exist. Skipping "
|
||||||
|
+ "deletion", cgf.getPath());
|
||||||
|
deleted = true;
|
||||||
}
|
}
|
||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user