Might be a ContainerSupport issue on macOS Docker Engine

Plenty Su plenty.su at gmail.com
Thu Aug 25 09:22:17 UTC 2022


Hi Severin,

Thank you for the answer.

I tested the command that you advised on macOS Docker Engine.
```
> docker run --rm -it --cpus 1 -m 1G {image based on OpenJDK 17} java
-XshowSettings:system -version
Operating System Metrics:
    Provider: cgroupv2
    Effective CPU Count: 1
    CPU Period: 100000us
    CPU Quota: 100000us
    CPU Shares: -1
    List of Processors: N/A
    List of Effective Processors, 4 total:
    0 1 2 3
    List of Memory Nodes: N/A
    List of Available Memory Nodes, 1 total:
    0
    Memory Limit: 1.00G
    Memory Soft Limit: 0.00K
    Memory & Swap Limit: 2.00G

openjdk version "17-ea" 2021-09-14
OpenJDK Runtime Environment (build 17-ea+14)
OpenJDK 64-Bit Server VM (build 17-ea+14, mixed mode, sharing)
```

As you guessed, macOS Docker Engine does use cgroups v2 to limit the
container's resources.
Then, I think I should just use OpenJDK 17 as the runtime solution.

Thank you for your help!


On Wed, Aug 24, 2022 at 8:53 PM Severin Gehwolf <sgehwolf at redhat.com> wrote:

> Hi,
>
> The code in JDK 17 and JDK 8 isn't 100% aligned. So it's hard to say.
> Please check which cgroups version is in use. Best to try with JDK 17
> using '-XshowSettings:system' switch when spawning the app. That should
> give some clues.
>
> For example the output here looks like this (note the 'Provider:'
> section):
>
> Operating System Metrics:
>     Provider: cgroupv1
>     Effective CPU Count: 8
>     CPU Period: 100000us
>     CPU Quota: -1
>     CPU Shares: -1
>     List of Processors, 8 total:
>     0 1 2 3 4 5 6 7
>     List of Effective Processors, 8 total:
>     0 1 2 3 4 5 6 7
>     List of Memory Nodes, 1 total:
>     0
>     List of Available Memory Nodes, 1 total:
>     0
>     Memory Limit: Unlimited
>     Memory Soft Limit: Unlimited
>     Memory & Swap Limit: Unlimited
>     Maximum Processes Limit: Unlimited
>
> openjdk version "17.0.4" 2022-07-19
> OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8)
> OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8,
> mixed mode, sharing)
>
> I'd expect for the affected system to be a cgroups v2 system, which
> isn't supported in JDK 8u (yet). See:
> https://bugs.openjdk.org/browse/JDK-8230305
>
>
> On Wed, 2022-08-24 at 18:52 +0900, Plenty Su wrote:
> >
> > I checked the cgroup files in the container. For example,
> > ```
> > # cat /sys/fs/cgroup/memory.max
> > 1073741824
> > ```
>
> memory.max is a cgroups v2 interface file. That suggests whatever macOS
> Docker Engine does, it uses some Linux with cgv2 underneath.
>
> HTH.
>
> Thanks,
> Severin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk8u-dev/attachments/20220825/fdf73c23/attachment.htm>


More information about the jdk8u-dev mailing list