RFR: 8278951: containers/cgroup/PlainRead.java fails on Ubuntu 21.10

Severin Gehwolf sgehwolf at openjdk.java.net
Thu Jan 13 10:53:32 UTC 2022


On Wed, 12 Jan 2022 07:17:51 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> When running on Ubuntu 21.10 (which has cgroupv2 enabled by default) but outside of a container, the VM was printing only this:
> 
> 
> [0.114s][debug][os,container] 
>    Open of file /sys/fs/cgroup/user.slice/user-529964.slice/session-1168.scope/cpu.weight failed,
>    No such file or directory
> 
> 
> After my fix, this is also printed to make the PlainRead.java test happy:
> 
> 
> [0.114s][trace][os,container] Raw value for CPU Shares is: -2
> 
> 
> Note that the `GET_CONTAINER_INFO_CPTR` and `GET_CONTAINER_INFO_LINE` macros still don't print the trace log when the requested file doesn't exist. I don't know whether I should change them or not. Since no tests seem to look for such a such a log message, I'll leave the code as-is for now.

Looks fine to me.

Note: I first wondered whether we needed to handle a `OSCONTAINER_ERROR` value in `CgroupV2Subsystem::cpu_shares()` but we don't as in that case the function returns early (`-2`) and `CgroupSubsystem::active_processor_count()` handles negative values appropriately.

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

Marked as reviewed by sgehwolf (Reviewer).

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


More information about the hotspot-runtime-dev mailing list