RFR: 8287073: NPE from CgroupV2Subsystem.getInstance() [v2]

Maxim Kartashev mkartashev at openjdk.java.net
Thu May 26 09:42:22 UTC 2022


On Thu, 26 May 2022 06:28:22 GMT, Peter Levart <plevart at openjdk.org> wrote:

>> @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.

@plevart I think I now understand what you meant and removed the unnecessary checks. Please, have a look.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8803


More information about the core-libs-dev mailing list