On Wed, 25 May 2022 14:39:42 GMT, Peter Levart <plev...@openjdk.org> wrote:
>> Following the logic from the comment directly above the changed line, since >> it doesn't matter which controller we pick, pick any available controller >> instead of the one called "memory" specifically. This way we are guarded >> against getting `null` as `anyController`, which is being immediately passed >> down to `CgroupV2Subsystem.getInstance()` that is unprepared to accept >> `null` values. >> >> It is also worth noting that the previous checks (such as that at line 89) >> make sure that there exist at least one controller in the map. > > src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java > line 113: > >> 111: CgroupInfo anyController = infos.values().iterator().next(); >> 112: CgroupSubsystem subsystem = >> CgroupV2Subsystem.getInstance(anyController); >> 113: return subsystem != null ? new CgroupMetrics(subsystem) : >> null; > > Looking at implementation of CgroupV2Subsystem.getInstance(...), it seems > that it always returns != null ... `CgroupV1Subsystem.getInstance(...)` also claims that it never returns `null`, but has a code-path that actually returns `null` (when there is no active controller). Is this a possible outcome? ------------- PR: https://git.openjdk.java.net/jdk/pull/8803