RFR: 8264482: container info misleads on non-container environment [v2]
Severin Gehwolf
sgehwolf at openjdk.java.net
Tue Apr 6 10:09:16 UTC 2021
On Tue, 6 Apr 2021 03:26:52 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>>> If there is an issue with reporting this stuff when not actually in a container then the fault lies in is_containerized() IMHO.
>>
>> To resolve this problem, I think [JDK-8261242](https://bugs.openjdk.java.net/browse/JDK-8261242) is filed. But the discussion does not seem to active... it might take a lot of time to fix because there might not be clear solution to detect the process runs on the container.
>>
>> As I said in before, I want to remove "container" from log output because it makes to mislead. Especially next JDK release is LTS, so the code will use a long time.
>> As an option, we can move logging code into `CgroupSubsystem`, but it might not be better...
>
>> If you are actually running under a cgroup and have resource limits
>> applied then aren't you effectively running in a "container"?
>
> No, we can see container logs even if the process is not limited by cgroups. I (and maybe JDK-8261242) want to say it is a problem.
>
> HotSpot detects whether it is run on container in following code. It checks whether specified directories exist.
>
> https://github.com/openjdk/jdk/blob/54b4070da76e79597a57412a39b85660dc49ce7c/src/hotspot/os/linux/cgroupSubsystem_linux.cpp#L44-L48
>
> According to [cgoups manpage](https://man7.org/linux/man-pages/man7/cgroups.7.html#NOTES), `/proc/cgroups` seems to generated by kernel, so we cannot use them to detect.
> I think we should fix like systemd, and JDK-8261242 has been discussed on to do so.
@YaSuenag Unfortunately that's the status quo, yes. On a plain linux system without cgroup limits for the java process, but with the cgroup subsystem mounted, it'll report some cgroup (container) metrics (same as the host values, though). What I'm unsure about is whether or not this is a problem worth fixing. The main idea is abstraction from cgroups in the container code. It does say `container (cgroup) information` in the heading.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3280
More information about the hotspot-runtime-dev
mailing list