RFR: 8274563: jfr/event/oldobject/TestClassLoaderLeak.java fails when GC cycles are not happening

Aleksey Shipilev shade at openjdk.java.net
Thu Sep 30 12:15:04 UTC 2021


This reliably fails with Serial (ignored by @requires), Shenandoah and Z:


$ CONF=linux-x86_64-server-fastdebug make run-test TEST=jdk/jfr/event/oldobject/TestClassLoaderLeak.java TEST_VM_OPTS="-XX:+UseShenandoahGC"

...

STDERR:
java.lang.RuntimeException: Could not find class leak
at jdk.test.lib.Asserts.fail(Asserts.java:594)
at jdk.jfr.event.oldobject.TestClassLoaderLeak.main(TestClassLoaderLeak.java:80)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:833)


I believe this test implicitly wants at least one GC cycle to happen so that `ObjectSampler::oop_storage_gc_notification` turns the sampled objects "old". An easy way to do this is to trim the Java heap size. If that does not work, we would need to go to MXBeans and watch GC cycles happening. 

Additional testing:
 - [x] Affected test with `-XX:+UseShenandoahGC`, 10 times
 - [x] Affected test with `-XX:+UseZGC`, 10 times
 - [x] Affected test with `-XX:+UseSerialGC`, 10 times
 - [x] Affected test with `-XX:+UseParallelGC`, 10 times
 - [x] Affected test with `-XX:+UseG1GC`, 10 times

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

Commit messages:
 - Trim down heap sizes

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

PR: https://git.openjdk.java.net/jdk/pull/5775


More information about the hotspot-jfr-dev mailing list