RFR: 8287073: NPE from CgroupV2Subsystem.getInstance()
Peter Levart
plevart at openjdk.java.net
Thu May 26 06:31:27 UTC 2022
On Wed, 25 May 2022 15:54:04 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:
>> `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;
> }
I was just contemplating the code around the change as it appears to have unnecessary checks which result in dead code. From the point of fixing just this concrete NPE, they are irrelevant. So while this code might benefit from cleanup, perhaps this PR is not the place to do it. Perhaps it is a matter of another issue and PR.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8803
More information about the core-libs-dev
mailing list