RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v2]
Jan Kratochvil
jkratochvil at openjdk.org
Wed Apr 17 01:09:46 UTC 2024
On Tue, 16 Apr 2024 15:17:33 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> The idea here is to use this property to tune OpenJDK for in-container, specifically k8s, use. In such a setup it's custom to run a single process within set resource constraints.
The in-container tuning means to use all the available resources. Containers in the real world have some memory limits set which is where my modified patch still correctly identifies it as a container to use all the available resources of the node which is the whole goal of the container detection code.
> In order to do this, we need a reliable way to distinguish that vs. non-containerized setup.
I expect it should have been written "We need a reliable way to distinguish real world in-container vs. non-containerized setup. We do not mind behavior for artificial containers on OpenJDK development machines.". Which is what my patch does in an easier and less error-prone way.
> If somebody really wants to run OpenJDK in a container expecting it to run like a physical OpenJDK deployment, that's when `-XX:-UseContainerSupport` should be used.
That behaves still the same with my patch.
Could you give a countercase where my patch behaves wrongly?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18201#issuecomment-2060158409
More information about the core-libs-dev
mailing list