ADDITIONAL SYSTEM INFORMATION :
Flatcar linux, Kubernetes, Java 16
A DESCRIPTION OF THE PROBLEM :
Cgroup initialization goes through two steps, first in finding the mount points from /proc/self/mountinfo, and then reading cgroup subsystem paths from /proc/self/cgroup. The latter file is a line based text file with 3 fields, split by colon.
This is currently parsed in the jdk with a bare split (https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java#L197). However, that split needs to have a limit of 2 set, so that the cgroupPath (the third element) may contain colon.
When the cgroupPath contains a colon, the extra portions of the path is silently thrown away. When the subsystem's path element is initialized (https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1SubsystemController.java#L45) it falls through, failing the prefix checks, and leaving path as null (perhaps an assertion should exist to ensure path is not null there). Finally, when any configuration file for the subsystem is attempted to be read, eg memory.is_hierarchy, Paths.get(path) is called and an NPE is thrown.
Additional investigation details can be found in https://github.com/kubernetes/kubernetes/issues/103944 and https://github.com/elastic/elasticsearch/issues/75767.
REGRESSION : Last worked in version 12
FREQUENCY : always