Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8164987

RTM jtreg tests failing due to unnamed module unable to access class jdk.internal.misc.Unsafe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 9
    • hotspot
    • b140
    • generic
    • linux

    Description

      On CPUs with RTM support (x64 and PPC64) the following tests are failing:

      FAILED: compiler/rtm/locking/TestRTMAbortRatio.java
      FAILED: compiler/rtm/locking/TestRTMAbortThreshold.java
      FAILED: compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
      FAILED: compiler/rtm/locking/TestRTMSpinLoopCount.java
      FAILED: compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
      FAILED: compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
      FAILED: compiler/rtm/locking/TestRTMLockingCalculationDelay.java
      FAILED: compiler/rtm/locking/TestRTMLockingThreshold.java
      FAILED: compiler/rtm/locking/TestRTMTotalCountIncrRate.java
      FAILED: compiler/rtm/locking/TestUseRTMAfterLockInflation.java
      FAILED: compiler/rtm/locking/TestUseRTMDeopt.java
      FAILED: compiler/rtm/locking/TestUseRTMForInflatedLocks.java
      FAILED: compiler/rtm/locking/TestRTMRetryCount.java
      FAILED: compiler/rtm/locking/TestUseRTMXendForLockBusy.java

      with similar a message:

      Exception in thread "main" java.lang.IllegalAccessError: class jdk.test.lib.Utils (in unnamed module @0x5c7fa833) cannot access class jdk.internal.misc.Unsafe (in module java.base) because module
      java.base does not export jdk.internal.misc to unnamed module @0x5c7fa833

      A possible workaround (although by no means a correct solution) is to export jdk.internal.misc to the world in the java.base:

      diff -r 84edc0512b0e src/java.base/share/classes/module-info.java
      --- a/src/java.base/share/classes/module-info.java Thu Aug 11 16:22:09 2016 -0700
      +++ b/src/java.base/share/classes/module-info.java Wed Aug 24 18:58:19 2016 -0400
      @@ -152,6 +152,8 @@
               jdk.dynalink,
               jdk.jartool,
               jdk.jlink;
      + exports jdk.internal.misc;
      +/*
           exports jdk.internal.misc to
               java.corba,
               java.desktop,
      @@ -170,6 +172,7 @@
               jdk.scripting.nashorn,
               jdk.unsupported,
               jdk.vm.ci;
      +*/
           exports jdk.internal.perf to
               java.desktop,
               java.management,

      The issue is not reproducible on CPUs without RTM support, where the above-mentioned tests pass just fine, since the following check exists:
      http://hg.openjdk.java.net/jdk9/hs-comp/file/9a47ecd3eeb9/test/lib/jdk/test/lib/cli/CommandLineOptionTest.java#l515

      which, by its turn, depends upon a CPU feature check:
      http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/64840dbba932/test/compiler/testlibrary/rtm/predicate/SupportedCPU.java#l36

      The issue can be reproduced using any RTM jtreg test, for instance the TestRTMAbortRatio.java:

      root@tm:~/hg/jdk9/hs-comp# /root/jtreg/bin/jtreg -version
      jtreg, version 4.2.0 dev tip
      Installed in /root/jtreg/lib/jtreg.jar
      Running on platform version 1.8.0_91 from /usr/lib/jvm/java-8-openjdk-amd64/jre.
      Built with 1.8.0_60 on 08/22/2016 01:49 PM.
      Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
      Use is subject to license terms.
      JCov 2.0-1
      TestNG (testng.jar): version 6.9.11
      TestNG (jcommander.jar): version unknown
      root@tm:~/hg/jdk9/hs-comp# lscpu | fgrep -o rtm
      rtm
      root@tm:~/hg/jdk9/hs-comp# hg paths
      default = http://hg.openjdk.java.net/jdk9/hs-comp/
      root@tm:~/hg/jdk9/hs-comp# hg id
      9a47ecd3eeb9 tip
      root@tm:~/hg/jdk9/hs-comp# hg --cwd ./jdk id
      6840c15304e7 tip
      root@tm:~/hg/jdk9/hs-comp# hg --cwd ./hotspot id
      64840dbba932+ tip
      root@tm:~/hg/jdk9/hs-comp# uname -a
      Linux tm 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
      root@tm:~/hg/jdk9/hs-comp# JT_JAVA=/usr/lib/jvm/java-8-openjdk-amd64/ /root/jtreg/bin/jtreg -agentvm -Xmx40m -conc:10 -va -a -w:test/hotspot/JTwork -r:test/hotspot/JTreport -jdk:./build/linux-x86_64-normal-server-release/jdk -timeout:3 /root/hg/jdk9/hs-comp/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java

      Attachments

        Issue Links

          Activity

            People

              gromero Gustavo Romero
              gromero Gustavo Romero
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: