The test failed intermittently with OutOfMemoryError under -Xcheck:jni 
-XX:+UseZGC (originally reported with -XX:+ZGenerational, which no longer 
exists after JEP 490). Reproduced on current builds at a stable 2% rate: 6 of
300 runs on four different hosts, all with the original signature.

GC logs from the failing runs show the 512m heap reaching 100% with ZGC in 
back-to-back allocation-stall collections that reclaim almost nothing, ending 
in the OOME while Allocator.helper grows its list. The test's live set is only 
about 20MB - five threads that each retain one ~2MB list and build one more - 
so the heap fills with garbage the in-flight concurrent cycle cannot yet prove 
dead: allocation outpaces concurrent collection at this heap size, with the 
sampling agent and -Xcheck:jni overhead on top. It is not a leak: the workload 
is bounded by construction, and the agent stores sampled objects via JNI weak 
global refs only (libHeapMonitorTest.cpp).

So I try to fix this by raise the test heap from -Xmx512m to -Xmx1g to give the 
concurrent
collector headroom, and add the bug id to @bug.

Testing: 500 repeats of the failing configuration (-Xcheck:jni -XX:+UseZGC, 
linux-x64-debug) all pass, where the 2% rate would have predicted about 10 
failures; 100 repeats of the default configuration all pass. A gc-logged run 
recording peak occupancy against the new limit is in progress; I'll post the 
number here.





---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8323421: 
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java fails 
with OOME

Changes: https://git.openjdk.org/jdk/pull/32229/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32229&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8323421
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/32229.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32229/head:pull/32229

PR: https://git.openjdk.org/jdk/pull/32229

Reply via email to