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

Soumyadeep Ganguly github.com+42171790+sganguly1999 at openjdk.java.net
Thu Sep 30 15:24:42 UTC 2021


On Thu, 30 Sep 2021 11:35:52 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> 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

Extremely sorry to interrupt here...But could you please tell me why we cannot call `Thread.start() `for the same instance of thread. I actually googled it but haven't got a satisfactory answer.
Please help me out

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

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


More information about the hotspot-jfr-dev mailing list