JDK-8146090 : java/lang/ref/ReachabilityFenceTest.java fails with -XX:+DeoptimizeALot
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version:
    9,10,11.0.5.0.50-oracle,11.0.6.0.1-oracle,12 9,10,11.0.5.0.50-oracle,11.0.6.0.1-oracle,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-12-23
  • Updated: 2020-03-06
  • Resolved: 2018-12-05
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
11.0.8-oracleFixed 12 b23Fixed
Related Reports
Relates :  
Description
Failed for multiple platforms.

----------messages:(3/220)----------
command: main -XX:TieredStopAtLevel=1 -Dpremature=true ReachabilityFenceTest
reason: User specified action: run main/othervm -XX:TieredStopAtLevel=1 -Dpremature=true ReachabilityFenceTest 
elapsed time (seconds): 20.402
----------System.out:(0/0)----------
----------System.err:(13/872)----------
java.lang.IllegalStateException: The object had never been finalized before timeout reached.
	at ReachabilityFenceTest.main(ReachabilityFenceTest.java:77)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:520)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
	at java.lang.Thread.run(Thread.java:747)

JavaTest Message: Test threw exception: java.lang.IllegalStateException: The object had never been finalized before timeout reached.
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.IllegalStateException: The object had never been finalized before timeout reached.

Comments
Fix request (11u) I would like to downport this for parity with 11.0.8-oracle. Applies clean.
05-03-2020

[~epavlova] Katya, I can reliably reproduce the failure with -XX:-TieredCompilation. From compilation log it turns out the test completely blocks Graal compilations by continuously triggering Full GCs. So, with -XX:-TieredCompilation the test is executed in interpreter and there's no chance for MyFinalizeable instance to be collected. With -XX:+TieredCompilation it's a mix of C1/interpreter. C1 compilation of ReachabilityFenceTest::fenced is delayed: $ .../bin/java -cp ... -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=graal -XX:+TieredCompilation -Dpremature=true -XX:CompileCommand=print,*::fenced -verbose:gc ReachabilityFenceTest ... [20.528s][info][gc] GC(299) Pause Full (System.gc()) 1M->1M(10M) 76.151ms [20.603s][info][gc] GC(300) Pause Full (System.gc()) 1M->1M(10M) 72.975ms Compiled method (c1) 20608 353 % ! 3 ReachabilityFenceTest::fenced @ 19 (73 bytes) ... [20.713s][info][gc] GC(301) Pause Full (System.gc()) 1M->1M(10M) 54.932ms [20.774s][info][gc] GC(302) Pause Full (System.gc()) 1M->1M(10M) 59.740ms ... [28.294s][info][gc] GC(406) Pause Full (System.gc()) 1M->1M(10M) 68.053ms Compiled method (c1) 28294 394 ! 3 ReachabilityFenceTest::fenced (73 bytes) ... [28.411s][info][gc] GC(407) Pause Full (System.gc()) 1M->1M(10M) 66.068ms [28.485s][info][gc] GC(408) Pause Full (System.gc()) 1M->1M(10M) 72.941ms ... [36.232s][info][gc] GC(495) Pause Full (System.gc()) 1M->1M(10M) 91.457ms ------------------------------------------------------------------------ If normal compilation happens too late, the test fails as well (I believe that's the scenario happened in your testing). Possible fix is to rework warmup phase in a way which reduces GC pressure and gives Graal a chance to compile the method. Or, as a workaround, use -Xbatch so test is blocked while compilation is in progress. (I see the test reliably passes with -Xbatch -XX:-TieredCompilation.)
17-04-2019

[~dholmes] the flag is used in hs-comp testing (tier7-8) and it turns on heavyweight stress mode. The actual flag combinations are: -ea -esa -XX:CompileThreshold=100 -server -XX:+-TieredCompilation [-Xcomp] -XX:+DeoptimizeALot I'm in favor of excluding the test, since I don't see much value in running the test with the flag explicitly disabled.
04-12-2018

What other flags are set in a test run that sets -XX:+DeoptimizeALot? Just wondering whether it is better to exclude the test or force DeoptimizeALot to be false.
04-12-2018

The test isn't suitable for execution with -XX:+DeoptimizeALot: -Dpremature=true expects execution to happen in compiled code, but -XX:+DeoptimizeALot triggers deoptimization at System.gc() calls and continues execution in interpreter. It breaks invariants the test checks. Proper fix is to exclude the test from execution w/ -XX:+DeoptimizeALot: diff --git a/test/jdk/java/lang/ref/ReachabilityFenceTest.java b/test/jdk/java/lang/ref/ReachabilityFenceTest.java --- a/test/jdk/java/lang/ref/ReachabilityFenceTest.java +++ b/test/jdk/java/lang/ref/ReachabilityFenceTest.java @@ -25,6 +25,8 @@ * @bug 8133348 * @summary Tests if reachabilityFence is working * + * @requires vm.opt.DeoptimizeALot != true + * * @run main/othervm -Xint -Dpremature=false ReachabilityFenceTest * @run main/othervm -XX:TieredStopAtLevel=1 -Dpremature=true ReachabilityFenceTest * @run main/othervm -XX:TieredStopAtLevel=2 -Dpremature=true ReachabilityFenceTest
04-12-2018

Failure reproducible when running with -XX:+DeoptimizeALot for the 2nd to last @run main: * @run main/othervm -XX:TieredStopAtLevel=1 -Dpremature=true ReachabilityFenceTest * @run main/othervm -XX:TieredStopAtLevel=2 -Dpremature=true ReachabilityFenceTest * @run main/othervm -XX:TieredStopAtLevel=3 -Dpremature=true ReachabilityFenceTest * @run main/othervm -XX:TieredStopAtLevel=4 -Dpremature=true ReachabilityFenceTest (The first one, * @run main/othervm -Xint -Dpremature=false ReachabilityFenceTest, still pass in this case) Is this test suitable for being run with DeoptimizeALot? Should it be excluded from such runs?
27-11-2018

Bumping priority to P3. This bug should not have been left to languish for years! The timeout issue should be investigated and either the test adjusted accordingly or excluded as needed.
22-11-2018

Spotted several failures in jdk12-jdk.864 and jdk12-jdk.888. Seems to happen 6-8 times in all tier 8 runs. Calling this a maintainer pain.
22-11-2018

Changing the Component to core-libs for now. Please correct if wrong. (Related to https://bugs.openjdk.java.net/browse/JDK-8133348) This java/lang/ref/ReachabilityFenceTest.java test seems to be option dependent and can the DeoptimizationALot flag used in product config test options caused failures! May be need to check better way to write option dependent test.
23-12-2015