RFR: 8284900: Check InitialHeapSize and container memory limits before startup [v9]
xpbob
duke at openjdk.java.net
Sat Apr 23 04:17:18 UTC 2022
On Sat, 23 Apr 2022 04:02:16 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:
>
> use os api
Thanks for review.
@iklam @jerboaa @DamonFool @stefank @dholmes-ora
os::physical_memory() return memory.limit_in_bytes in cgroupv1. In a container environment, swap is usually disabled, it makes sense to limit xms with this. The detection here needs to work only under the container.
The JVM is currently unable to calculate the memory footprint of a program at startup.Use the memory of the user's thread, which is available after startup.Boot is to detect memory to avoid oom not having enough data.
Currently Xms Settings in non-container environments exceed physical machine memory and exit,The container should behave like a physical machine
java -Xms40g -version
penJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007fd8ac600000, 28633464832, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 28633464832 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /data/test/docker/hs_err_pid15626.log
-------------
PR: https://git.openjdk.java.net/jdk/pull/8256
More information about the hotspot-gc-dev
mailing list