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

chengjingwei (A) chengjingwei1 at huawei.com
Fri May 24 08:02:10 UTC 2019


It seems that it's not intending to obtain 4GB memory, but forcing
overflow of capacity_until_GC, according to the comment in the testcase.

In the previous versions, this wouldn't get a false value returned from MetaspaceGC::inc_capacity_until_GC,
so the test used to pass. But now false is returned and the test is broken. 

I guess WB_IncMetaspaceCapacityUntilGC in whitebox.cpp needs to be repaired too, but I'm not sure.
Do you have any suggestions?

Thanks



-----邮件原件-----
发件人: Yasumasa Suenaga [mailto:yasuenag at gmail.com] 
发送时间: 2019年5月21日 10:41
收件人: chengjingwei (A) <chengjingwei1 at huawei.com>
抄送: hotspot-gc-dev at openjdk.java.net
主题: Re: PING: RFR: 8217432: MetaspaceGC::_capacity_until_GC exceeds MaxMetaspaceSize

Hi,

I think the result which you saw is correct because 32 bit platform cannot obtain 4GB memory.

IMHO you need to remove or modify this testcase.


Thanks,

Yasumasa


2019年5月21日(火) 10:50 chengjingwei (A) <chengjingwei1 at huawei.com>:
>
> 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.jav
> > a: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?
>
>


More information about the hotspot-gc-dev mailing list