RFR: 8215451: JNI IsSameObject should not keep objects alive

Per Liden per.liden at oracle.com
Sat Dec 15 14:22:37 UTC 2018


On 12/15/2018 01:36 PM, Erik Osterlund wrote:
> Hi Per,
> 
> Looks good.

Thanks for reviewing, Erik!

> Maybe stick a /* decorators */ comment next to the 0 literal on the 
> following line:
> 
> resolve_impl<0, false /* external_guard */>(handle);
> 
> Don’t need another webrev for that.

Good suggestions, fixed in-place.

cheers,
Per

> 
> Thanks,
> /Erik
> 
> On 15 Dec 2018, at 11:41, Per Liden <per.liden at oracle.com 
> <mailto:per.liden at oracle.com>> wrote:
> 
>> JNI IsSameObject should resolve the JNIHandles its comparing without 
>> keeping the objects they point to alive. Otherwise, checking if a 
>> jweak is reachable by doing IsSameObject(jweak, NULL) will be counter 
>> productive, as it will make sure that jweak stays alive.
>>
>> This is currently only a problem when using ZGC, which does concurrent 
>> jweak processing.
>>
>> This was found by the 
>> "test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java" 
>> test, which keeps a list of jweaks, which it will periodically iterate 
>> over and do IsSameObject(jweak, NULL) to determine if any of them have 
>> been cleared. The end result is the these jweaks will never be cleared 
>> and the heap eventually gets full and an OOME is thrown.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8215451
>> Webrev: http://cr.openjdk.java.net/~pliden/8215451/webrev.0
>>
>> /Per


More information about the hotspot-runtime-dev mailing list