JDK-8215451 : JNI IsSameObject should not keep objects alive
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11,12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-12-15
  • Updated: 2019-09-04
  • Resolved: 2018-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13
11.0.5Fixed 12 b25Fixed 13Fixed
Related Reports
Blocks :  
Description
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.
Comments
Fix Request (11u) This backport fixes accidental resurrection of jweaks by JNIHandles walking code. This was found on ZGC, but would affect Shenandoah as well once concurrent JNI handling is backported. Patch applies cleanly to 11u, passes tier1, tier2. Requires JDK-8210063 to be backported first.
25-06-2019