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

chengjingwei (A) chengjingwei1 at huawei.com
Fri May 17 03:54:08 UTC 2019


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/20190517/60ccaa14/attachment.htm>


More information about the hotspot-gc-dev mailing list