PING: RFR: 8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize

chengjingwei (A) chengjingwei1 at huawei.com
Tue May 21 01:50:41 UTC 2019


By the way, the link of the patch that caused problems was https://bugs.openjdk.java.net/browse/JDK-8217432.

The test would fail with 32-bit jdk even on 64-bit platforms.



> Hi,

>

> After this patch was applied (since jdk8u212 and jdk-11.0.3, to be specific), we started to get test failures with jtreg.

> The failed test case was jdk8u/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java.

>

> It always fails on windows-32bit platform, and fails on linux-32bit if -XX:MaxMetaspaceSize is set.

>

>  The failure message was:

> java.lang.IllegalStateException: WB_IncMetaspaceCapacityUntilGC: could not increase capacity until GC due to contention with another thread

>         at sun.hotspot.WhiteBox.incMetaspaceCapacityUntilGC(Native Method)

>         at TestCapacityUntilGCWrapAround.main(TestCapacityUntilGCWrapAround.java:51)

>

> I checked the code, and found that MetaspaceGC::inc_capacity_until_GC was passed a value of 4G-page_size-1,

> which caused addition overflow when computing new_value, and new_value always set to "align_size_down(max_uintx, Metaspace::commit_alignment())".

> So when MaxMetaspaceSize defaults to or is set to a value less than it, the function will return false to WB_IncMetaspaceCapacityUntilGC,

> which will then throw an Exception, causing the test failure.

>

> On win-32 platform, the default value of MaxMetaspaceSize is 4G - allocation_granularity,

> which is 4G - 64K (according to https://devblogs.microsoft.com/oldnewthing/20031008-00/?p=42223),

> this is very likely to be less than "new_value" and cause test failure.

>

> Do you have any idea how to fix this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20190521/94c13975/attachment.htm>


More information about the hotspot-gc-dev mailing list