On Wed, 25 May 2022 14:47:06 GMT, Peter Levart <[email protected]> wrote:
>> 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?
@plevart Are you asking about the reason for the crash or about the changes?
If it's the former, then I believe that the crash comes not from
`getInstance()` returning `null`, but from further down the stack because
`null` is being passed to `getInstance()`. I could be wrong in interpreting the
report, though.
If the question's about the changes, then those are restricted to CgroupV2, so
I'm not sure how `CgroupV1Subsystem.getInstance(...)` returning null is
related. FWIW, I also don't think we are going to get here if there are no
active controllers. There's this code a few lines above:
if (!result.isAnyControllersEnabled()) {
return null;
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/8803