RFR: 8257746: Regression introduced with JDK-8250984 - memory might be null in some machines

Poonam Bajaj poonam at openjdk.java.net
Thu Jan 28 17:22:40 UTC 2021

On Thu, 28 Jan 2021 16:00:36 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> > I'm curious: What config is this to actually trigger the NPE? How does `/proc/self/mountinfo`, `/proc/self/cgroup` and `/proc/cgroups` look like?
> > > I'm curious: What config is this to actually trigger the NPE? How does `/proc/self/mountinfo`, `/proc/self/cgroup` and `/proc/cgroups` look like?
> > 
> > 
> > I don't have access to the config. The issue was reported by a customer.
> This isn't very satisfying, though. How can we be sure this issue isn't also present in the cgroup v2 code? Has this been tested? Surely, there was some stack trace reported by the customer or some sort of reproducer got provided. What was the reasoning that established this issue is present in JDK head and **only** in cgroups v1 code? My guess is that the issue got triggered via the OperatingSystemMXBean, but nothing to that effect has been noted here or in the bug.
> If I were to propose such a point fix, clearly, I'd have to provide some details what the actual problem is and explain why the fix is sufficient and covers all branches. All that got provided is: "But memory could be Null on some machines that have cgroup entries for CPU but not for memory."

I can check with the customer if they could share their config. 

The cgroups v2 code was thoroughly examined and this problem does not exist in that code. cgroups v2 does not have a separate MemorySubSystemController as we have for c1 cgroups. 

An instance of the CgroupV1MemorySubSystemController is stored as a member in CgroupV1Subsystem.

    private CgroupV1MemorySubSystemController memory;

    private void setMemorySubSystem(CgroupV1MemorySubSystemController memory) {
          this.memory = memory;

This memory instance variable could stay null if "memory" entry is not found while creating sub-system objects in createSubSystemController(). 

               case "memory":
                      subsystem.setMemorySubSystem(new CgroupV1MemorySubSystemController(mountentry[3], mountentry[4]));

This fix ensure that the memory instance is not null before invoking any method on it.

Such problem does not exist in cgroups v2 code.


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

More information about the core-libs-dev mailing list