RFR: 8284900: Check InitialHeapSize and container memory limits before startup [v3]

Ioi Lam iklam at openjdk.java.net
Mon Apr 18 16:45:34 UTC 2022


On Sun, 17 Apr 2022 14:47:33 GMT, xpbob <duke at openjdk.java.net> wrote:

>> Check InitialHeapSize and container memory limits before startup
>> 
>> 
>> 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: N/A
>>     List of Memory Nodes, 1 total: 
>>     0 
>>     List of Available Memory Nodes: N/A
>>     Memory Limit: 50.00M
>>     Memory Soft Limit: Unlimited
>>     Memory & Swap Limit: 60.00M
>>     Maximum Processes Limit: 4194305
>> 
>> command:-Xms60m -XshowSettings:system -version 
>> 
>> 
>> 
>> 
>> When the memory limit is exceeded, the startup fail with message
>> 
>> 
>> 
>> Error occurred during initialization of VM
>> Initial heap size set to a larger value than the container memory & swap limit
>
> xpbob has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add define for linux

Could you update the bug report to indicate the exact command used? This is not very clear:


Start the command:cgexec -g memory:foo -Xms60m xxx

src/hotspot/share/gc/shared/gcArguments.cpp line 137:

> 135:     vm_exit_during_initialization("Initial heap size set to a larger value than the container memory & swap limit");
> 136:   }
> 137:   #endif

`OSContainer::memory_and_swap_limit_in_bytes()` is an expensive operation. It opens files and read their contents.  The returned value should be stored in a local to avoid calling this function twice.

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

PR: https://git.openjdk.java.net/jdk/pull/8256



More information about the hotspot-gc-dev mailing list