RFR: 8261242: [Linux] OSContainer::is_containerized() returns true when run outside a container [v2]

Severin Gehwolf sgehwolf at openjdk.org
Fri May 3 16:12:53 UTC 2024


On Fri, 3 May 2024 15:58:11 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> src/java.base/share/classes/sun/launcher/LauncherHelper.java line 375:
>> 
>>> 373:         if (!c.isContainerized()) {
>>> 374:             ostream.println(INDENT + "System not containerized.");
>>> 375:             return;
>> 
>> Why return here? Would this not cut the output short in the non-containerized case?
>> 
>> And if this not intended, the not-containerized-`-XshowSettings:system` test below should test and catch this (e.g. scan for CPU set)
>
>> Why return here?
> 
> Because it's not useful to see containerized settings (other than the cg version in use) after this patch. The JVM won't use them (uses the physical settings instead). Why would you want to show the settings?

To clarify. `showSettings:system` output on a host system:


Operating System Metrics:
    Provider: cgroupv1
    System not containerized.
openjdk 23-internal 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing)


... and in a container (with memory limit 500m):


Operating System Metrics:
    Provider: cgroupv1
    Effective CPU Count: 12
    CPU Period: 100000us
    CPU Quota: -1
    CPU Shares: -1
    List of Processors, 12 total: 
    0 1 2 3 4 5 6 7 8 9 10 11 
    List of Effective Processors, 12 total: 
    0 1 2 3 4 5 6 7 8 9 10 11 
    List of Memory Nodes, 1 total: 
    0 
    List of Available Memory Nodes, 1 total: 
    0 
    Memory Limit: 500.00M
    Memory Soft Limit: Unlimited
    Memory & Swap Limit: 500.00M
    Maximum Processes Limit: 2048

openjdk 23-internal 2024-09-17
OpenJDK Runtime Environment (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk)
OpenJDK 64-Bit Server VM (fastdebug build 23-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18201#discussion_r1589407238


More information about the serviceability-dev mailing list