JDK-8292360 : [riscv] WeakCompareAndSet fails for some tests
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 19,20
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: riscv
  • Submitted: 2022-08-15
  • Updated: 2022-08-16
Related Reports
Relates :  
Description
I have been running tier1 on sifive unmatched and alibaba's thead board and found some tests ( which use WeakCompareAndSet* functionality) to fail intermitently.
They fail more often on slower board ( sifive), and rarely on faster board ( thead)

lists of tests to fail:
hotspot:tier1
compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java: Test unsafe access for char
compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java: Test unsafe access for double

jdk:tier1

java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java:
java/lang/invoke/VarHandles/VarHandleTestAccessByte.java:
java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java:
java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java:
java/lang/invoke/VarHandles/VarHandleTestAccessInt.java:
java/lang/invoke/VarHandles/VarHandleTestAccessLong.java:
java/lang/invoke/VarHandles/VarHandleTestAccessShort.java:
java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java:
java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java:
java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java:
java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java:
java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java:


example stack trace from jtr file:

test compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testArrayOffHeap(): failure
java.lang.AssertionError: weakCompareAndSetAcquire double expected [true] but found [false]
        at org.testng.Assert.fail(Assert.java:99)
        at org.testng.Assert.failNotEquals(Assert.java:1037)
        at org.testng.Assert.assertEqualsImpl(Assert.java:140)
        at org.testng.Assert.assertEquals(Assert.java:122)
        at org.testng.Assert.assertEquals(Assert.java:819)
        at compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testAccess(JdkInternalMiscUnsafeAccessTestDouble.java:254)
        at compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testArrayOffHeap(JdkInternalMiscUnsafeAccessTestDouble.java:125)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
        at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
        at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
        at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
        at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
        at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testng.TestRunner.privateRun(TestRunner.java:764)
        at org.testng.TestRunner.run(TestRunner.java:585)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
        at org.testng.SuiteRunner.run(SuiteRunner.java:286)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
        at org.testng.TestNG.runSuites(TestNG.java:1069)
        at org.testng.TestNG.run(TestNG.java:1037)
        at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
        at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:1589)

and:

test compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testFieldInstance(): failure
java.lang.AssertionError: weakCompareAndSetPlain double expected [true] but found [false]
        at org.testng.Assert.fail(Assert.java:99)
        at org.testng.Assert.failNotEquals(Assert.java:1037)
        at org.testng.Assert.assertEqualsImpl(Assert.java:140)
        at org.testng.Assert.assertEquals(Assert.java:122)
        at org.testng.Assert.assertEquals(Assert.java:819)
        at compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testAccess(JdkInternalMiscUnsafeAccessTestDouble.java:244)
        at compiler.unsafe.JdkInternalMiscUnsafeAccessTestDouble.testFieldInstance(JdkInternalMiscUnsafeAccessTestDouble.java:97)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
        at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
        at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
        at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
        at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
        at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.testng.TestRunner.privateRun(TestRunner.java:764)
        at org.testng.TestRunner.run(TestRunner.java:585)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
        at org.testng.SuiteRunner.run(SuiteRunner.java:286)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
        at org.testng.TestNG.runSuites(TestNG.java:1069)
        at org.testng.TestNG.run(TestNG.java:1037)
        at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
        at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:1589)


list of tests: