8272124: Cgroup v1 initialization causes NullPointerException when cgroup path contains colon

Reviewed-by: mseledtsov, sgehwolf
This commit is contained in:
Harold Seigel 2021-08-18 14:24:58 +00:00
parent 30b0f820ce
commit 4d6593ce02
2 changed files with 57 additions and 3 deletions

View file

@ -196,9 +196,10 @@ public class CgroupSubsystemFactory {
if (isCgroupsV2) {
action = (tokens -> setCgroupV2Path(infos, tokens));
}
selfCgroupLines.map(line -> line.split(":"))
.filter(tokens -> (tokens.length >= 3))
.forEach(action);
// The limit value of 3 is because /proc/self/cgroup contains three
// colon-separated tokens per line. The last token, cgroup path, might
// contain a ':'.
selfCgroupLines.map(line -> line.split(":", 3)).forEach(action);
}
CgroupTypeResult result = new CgroupTypeResult(isCgroupsV2,