RFR: 8264482: container info misleads on non-container environment [v2]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Tue Apr 6 03:30:25 UTC 2021
On Tue, 6 Apr 2021 02:28:46 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> Sorry Yasumasa but I don't agree with this. OSContainer is supposed to be the abstraction representing a containerized environment. Calling code doesn't know (nor care) what the underlying mechanism is - maybe it is cgroups, maybe it isn't. If there is an issue with reporting this stuff when not actually in a container then the fault lies in is_containerized() IMHO.
>>
>> David
>
>> 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.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3280
More information about the hotspot-runtime-dev
mailing list