RFR: 8257230: assert(InitialHeapSize >= MinHeapSize) failed: Ergonomics decided on incompatible initial and minimum heap sizes
sjohanss at openjdk.java.net
Mon Nov 30 13:55:57 UTC 2020
On Sat, 28 Nov 2020 13:08:38 GMT, Jie Fu <jiefu at openjdk.org> wrote:
> Hi all,
> Ergonomics for InitialHeapSize can be broken if the memory resource is limited by the administrator.
> For example, this assert  fired on our testing boxes.
> It can be reproduced by the following two steps on Linux-64:
> 1) ulimit -v 8388608
> 2) java -XX:MinHeapSize=5g -version
> The reason was that limit_by_allocatable_memory()  returns a value less than MinHeapSize.
> One more important fact is that this bug can be more common on Linux-32 systems.
> Since the virtual memory is limited to 3800M  on Linux-32, it can be always reproduced when MinHeapSize > 1900M.
> - tier1 ~ tier3 on Linux/x64
> Best regards,
>  https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shared/gcArguments.cpp#L96
>  https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/arguments.cpp#L1907
>  https://github.com/openjdk/jdk/blob/master/src/hotspot/os/posix/os_posix.cpp#L567
src/hotspot/share/runtime/arguments.cpp line 1909:
> 1907: reasonable_initial = limit_by_allocatable_memory(reasonable_initial);
> 1909: FLAG_SET_ERGO(InitialHeapSize, MAX2((size_t)reasonable_initial, MinHeapSize));
I'm not sure this is a good fix, this would violate the limit set by:
Wouldn't the proper fix be to make sure that MinHeapSize is also limited by what's allowed to allocate?
More information about the hotspot-gc-dev