Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JTReg test fail : java/util/concurrent/LinkedTransferQueue/WhiteBox.java #3205

Closed
ben-walsh opened this issue Oct 10, 2018 · 2 comments · Fixed by #4192
Closed

JTReg test fail : java/util/concurrent/LinkedTransferQueue/WhiteBox.java #3205

ben-walsh opened this issue Oct 10, 2018 · 2 comments · Fixed by #4192

Comments

@ben-walsh
Copy link
Contributor

ben-walsh commented Oct 10, 2018

Test failure at https://github.com/ibmruntimes/openj9-openjdk-jdk11/blob/openj9/test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java#L390 ...

test WhiteBox.cancelledNodeSweeping(): failure
java.lang.IllegalArgumentException: bound must be positive
	at java.base/java.util.concurrent.ThreadLocalRandom.nextInt(ThreadLocalRandom.java:310)
	at WhiteBox.cancelledNodeSweeping(WhiteBox.java:390)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at org.testng.TestRunner.privateRun(TestRunner.java:773)
	at org.testng.TestRunner.run(TestRunner.java:623)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
	at org.testng.SuiteRunner.run(SuiteRunner.java:259)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
	at org.testng.TestNG.run(TestNG.java:1018)
	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.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115)
	at java.base/java.lang.Thread.run(Thread.java:825)

Digging deeper, execution of this ...

import java.util.concurrent.LinkedTransferQueue;
import java.lang.invoke.MethodHandles;

public class Test {

   public static void main(String args[]) throws ReflectiveOperationException {

      Class<?> qClass = LinkedTransferQueue.class;
      Class<?> nodeClass = Class.forName(qClass.getName() + "$Node");
      MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(qClass, MethodHandles.lookup());
      int SWEEP_THRESHOLD = (int) lookup.findStaticVarHandle(qClass, "SWEEP_THRESHOLD", int.class).get();

      System.out.println("SWEEP_THRESHOLD : " + SWEEP_THRESHOLD);

   }

}

... yields ...

walshbp@bendev:~/jtreg_testing$ /home/walshbp/openjdk11-openj9-binary/jdk-11+28/bin/javac Test.java
walshbp@bendev:~/jtreg_testing$ /home/walshbp/openjdk11-openj9-binary/jdk-11+28/bin/java Test
SWEEP_THRESHOLD : 0
walshbp@bendev:~/jtreg_testing$ /home/walshbp/openjdk11-hotspot-binary/jdk-11/bin/javac Test.java
walshbp@bendev:~/jtreg_testing$ /home/walshbp/openjdk11-hotspot-binary/jdk-11/bin/java Test
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access using Lookup on Test (file:/home/walshbp/jtreg_testing/) to class java.util.concurrent.LinkedTransferQueue
WARNING: Please consider reporting this to the maintainers of Test
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
SWEEP_THRESHOLD : 32

I don't see anything in the source code to explain why the SWEEP_THRESHOLD value set in the JCL LinkedTransferQueue impl is changed from 32 to 0 when executing against OpenJ9 ...

walshbp@bendev:~/jep_testing/openj9-openjdk-jdk11$ egrep -r "SWEEP_THRESHOLD"
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:    final int SWEEP_THRESHOLD;
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:        SWEEP_THRESHOLD = (int)
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:            lookup.findStaticVarHandle(qClass, "SWEEP_THRESHOLD", int.class)
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:        assertEquals(SWEEP_THRESHOLD & (SWEEP_THRESHOLD - 1), 0);
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:            while (nodeCount(q) < initialNodeCount + SWEEP_THRESHOLD / 2)
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:        // ... but no more than SWEEP_THRESHOLD nodes accumulate
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:        for (int i = rnd.nextInt(SWEEP_THRESHOLD * 10); i-->0; )
test/jdk/java/util/concurrent/LinkedTransferQueue/WhiteBox.java:        assertTrue(nodeCount(q) <= initialNodeCount + SWEEP_THRESHOLD);
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java:     * ("SWEEP_THRESHOLD") indicating the maximum number of estimated
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java:    static final int SWEEP_THRESHOLD = 32;
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java:        // assert (SWEEP_THRESHOLD & (SWEEP_THRESHOLD - 1)) == 0;
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java:                // sweep every SWEEP_THRESHOLD votes
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java:                    && (incSweepVotes() & (SWEEP_THRESHOLD - 1)) == 0)

This test passes against Hotspot.

Log archive : LinkTransQProb.tar.gz

@JasonFengJ9
Copy link
Member

Looking at this.

@smlambert
Copy link
Contributor

Test excluded: adoptium/aqa-tests#628
If fixed, then needs to be re-included.

ben-walsh added a commit to ben-walsh/openjdk-tests that referenced this issue Feb 20, 2019
java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java eclipse-openj9/openj9#3180	generic-all

java/lang/invoke/condy/CondyWrongType.java eclipse-openj9/openj9#3185	generic-all

java/util/Spliterator/SpliteratorCharacteristics.java eclipse-openj9/openj9#3202	generic-all

java/util/concurrent/LinkedTransferQueue/WhiteBox.java eclipse-openj9/openj9#3205	generic-all

java/util/prefs/PrefsSpi.sh eclipse-openj9/openj9#3232	generic-all

java/lang/invoke/8147078/Test8147078.java eclipse-openj9/openj9#3271	generic-all

java/lang/invoke/8177146/TestMethodHandleBind.java eclipse-openj9/openj9#3273	generic-all

java/lang/invoke/ProtectedMemberDifferentPackage/Test.java eclipse-openj9/openj9#3301	generic-all

java/lang/invoke/modules/Driver.java eclipse-openj9/openj9#3411	generic-all

java/lang/System/OsVersionTest.java eclipse-openj9/openj9#4188 macosx-all

java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java eclipse-openj9/openj9#4301 generic-all

java/lang/String/Chars.java eclipse-openj9/openj9#4301 generic-all

java/security/Signature/ResetAfterException.java eclipse-openj9/openj9#4315 generic-all
smlambert pushed a commit to adoptium/aqa-tests that referenced this issue Feb 20, 2019
java/lang/invoke/VarHandles/VarHandleMethodReferenceTest.java eclipse-openj9/openj9#3180	generic-all

java/lang/invoke/condy/CondyWrongType.java eclipse-openj9/openj9#3185	generic-all

java/util/Spliterator/SpliteratorCharacteristics.java eclipse-openj9/openj9#3202	generic-all

java/util/concurrent/LinkedTransferQueue/WhiteBox.java eclipse-openj9/openj9#3205	generic-all

java/util/prefs/PrefsSpi.sh eclipse-openj9/openj9#3232	generic-all

java/lang/invoke/8147078/Test8147078.java eclipse-openj9/openj9#3271	generic-all

java/lang/invoke/8177146/TestMethodHandleBind.java eclipse-openj9/openj9#3273	generic-all

java/lang/invoke/ProtectedMemberDifferentPackage/Test.java eclipse-openj9/openj9#3301	generic-all

java/lang/invoke/modules/Driver.java eclipse-openj9/openj9#3411	generic-all

java/lang/System/OsVersionTest.java eclipse-openj9/openj9#4188 macosx-all

java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java eclipse-openj9/openj9#4301 generic-all

java/lang/String/Chars.java eclipse-openj9/openj9#4301 generic-all

java/security/Signature/ResetAfterException.java eclipse-openj9/openj9#4315 generic-all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants