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

java.lang.IllegalAccessException thrown for jdk.internal.misc.Unsafe.theUnsafe in Valhalla vt_standard testing #20372

Open
hzongaro opened this issue Oct 17, 2024 · 11 comments
Labels
project:valhalla Used to track Project Valhalla related work triageRequired

Comments

@hzongaro
Copy link
Member

hzongaro commented Oct 17, 2024

Many test failures are seen in recent PR sanity.functional testing with {x|z|a|p}linuxvalst (i.e., vt_standard) for pull requests #20112 and #20332. In most, if not all, cases IllegalAccessExceptions are thrown. I was able to reproduce this in an internal personal build with the latest merged source.

12:45:24  openjdk version "24-internal" 2025-03-18
12:45:24  OpenJDK Runtime Environment (build 24-internal-adhoc.jenkins.BuildJDKnextx86-64linuxvtstandardPersonal)
12:45:24  Eclipse OpenJ9 VM (build master-d51176e7598, JRE 24 Linux amd64-64-Bit Compressed References 20241016_390 (JIT enabled, AOT enabled)
12:45:24  OpenJ9   - d51176e7598
12:45:24  OMR      - 0de486a739f
12:45:24  JCL      - 972edea3789 based on jdk-24+12)
13:00:49  Testing: Create and Restore Criu Checkpoint Image once - CheckpointDeadlock
13:00:49  Test start time: 2024/10/16 10:00:48 Pacific Standard Time
13:00:49  Running command: bash /home/jenkins/workspace/Test_openjdknext_j9_sanity.functional_x86-64_linux_vt_standard_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/criu/criuScript.sh /home/jenkins/workspace/Test_openjdknext_j9_sanity.functional_x86-64_linux_vt_standard_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/criu /home/jenkins/workspace/Test_openjdknext_j9_sanity.functional_x86-64_linux_vt_standard_Personal_testList_1/jdkbinary/j2sdk-image/bin/java " -Xjit -XX:+CRIURestoreNonPortableMode  --add-opens java.base/jdk.internal.misc=ALL-UNNAMED  --add-exports java.base/openj9.internal.criu=ALL-UNNAMED" org.openj9.criu.DeadlockTest CheckpointDeadlock 1 false false
13:00:49  Time spent starting: 2 milliseconds
13:00:51  Time spent executing: 2266 milliseconds
13:00:51  Test result: FAILED
13:00:51  Output from test:
13:00:51   [OUT] start running script
13:00:51   [OUT] export GLIBC_TUNABLES=glibc.cpu.hwcaps=-XSAVEC,-XSAVE,-AVX2,-ERMS,-AVX,-AVX_Fast_Unaligned_Load
13:00:51   [OUT] export LD_BIND_NOT=on
13:00:51   [OUT] /home/jenkins/workspace/Test_openjdknext_j9_sanity.functional_x86-64_linux_vt_standard_Personal_testList_1/jdkbinary/j2sdk-image/bin/java -XX:+EnableCRIUSupport  -Xjit -XX:+CRIURestoreNonPortableMode  --add-opens java.base/jdk.internal.misc=ALL-UNNAMED  --add-exports java.base/openj9.internal.criu=ALL-UNNAMED -cp /home/jenkins/workspace/Test_openjdknext_j9_sanity.functional_x86-64_linux_vt_standard_Personal_testList_1/aqa-tests/TKG/../../jvmtest/functional/cmdLineTests/criu/criu.jar org.openj9.criu.DeadlockTest CheckpointDeadlock 1
13:00:51   [OUT] Exception in thread "main" java.lang.InternalError: java.lang.IllegalAccessException: static final field has no write access: jdk.internal.misc.Unsafe.theUnsafe/jdk.internal.misc.Unsafe/putStatic, from class java.lang.Object (module java.base)
13:00:51   [OUT] 	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newFieldAccessor(MethodHandleAccessorFactory.java:207)
13:00:51   [OUT] 	at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:144)
13:00:51   [OUT] 	at java.base/java.lang.reflect.Field.acquireOverrideFieldAccessor(Field.java:1212)
13:00:51   [OUT] 	at java.base/java.lang.reflect.Field.getOverrideFieldAccessor(Field.java:1181)
13:00:51   [OUT] 	at java.base/java.lang.reflect.Field.get(Field.java:454)
13:00:51   [OUT] 	at org.openj9.criu.DeadlockTest.<clinit>(DeadlockTest.java:356)
13:00:51   [OUT] Caused by: java.lang.IllegalAccessException: static final field has no write access: jdk.internal.misc.Unsafe.theUnsafe/jdk.internal.misc.Unsafe/putStatic, from class java.lang.Object (module java.base)
13:00:51   [OUT] 	at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:913)
13:00:51   [OUT] 	at java.base/java.lang.invoke.MethodHandles$Lookup.unreflectField(MethodHandles.java:3608)
13:00:51   [OUT] 	at java.base/java.lang.invoke.MethodHandles$Lookup.unreflectSetter(MethodHandles.java:3599)
13:00:51   [OUT] 	at java.base/java.lang.invoke.MethodHandleImpl$1.unreflectField(MethodHandleImpl.java:1621)
13:00:51   [OUT] 	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newFieldAccessor(MethodHandleAccessorFactory.java:185)
13:00:51   [OUT] 	... 5 more
13:00:51   [OUT] initiate restore
13:00:51   [OUT] Error (criu/protobuf.c:72): Unexpected EOF on (empty-image)
13:00:51   [OUT] Removed test output files
13:00:51   [OUT] finished script
@hzongaro hzongaro added project:valhalla Used to track Project Valhalla related work triageRequired labels Oct 17, 2024
@hzongaro
Copy link
Member Author

@theresa-m, @a7ehuo - FYI

Copy link

Issue Number: 20372
Status: Open
Recommended Components: comp:test, comp:vm, comp:gc
Recommended Assignees: jasonfengj9, tajila, babsingh

@hangshao0
Copy link
Contributor

The failed line is:

@JasonFengJ9 Do you know if this fails on regular JDK24 build ?

@JasonFengJ9
Copy link
Member

JasonFengJ9 commented Oct 17, 2024

Do you know if this fails on regular JDK24 build ?

Currently, there are no JDK24 nightly builds.
Last openjdknext_j9_sanity.functional_aarch64_mac passed on Oct. 3rd.
Launched a JDKnext_x86-64_linux.

@JasonFengJ9
Copy link
Member

Those failed tests in openjdknext_j9_sanity.functional_x86-64_linux_vt_standard passed in a regular openjdkNext_j9_sanity.functional_x86-64_linux

cmdLineTester_criu_nonPortableRestore_0_PASSED
...
cmdLineTester_libpathTestRtf_0_PASSED
...

FYI @hangshao0

@hangshao0
Copy link
Contributor

Have you seen this failure before ? @babsingh @fengxue-IS

The https://github.com/ibmruntimes/openj9-openjdk-jdk.valuetypes repo is a few weeks behind https://github.com/ibmruntimes/openj9-openjdk-jdk though.

@keithc-ca
Copy link
Contributor

Two possible solutions come to mind:

  1. update https://github.com/ibmruntimes/openj9-openjdk-jdk.valuetypes - perhaps this is already fixed upstream
  2. change the way the Unsafe instance is acquired in tests - we're already using --add-opens to gain access to the package so we could just use Unsafe.getUnsafe() rather than reflection

@babsingh
Copy link
Contributor

Have you seen this failure before ?

It seems new. I haven't seen it before.

@theresa-m
Copy link
Contributor

theresa-m commented Oct 22, 2024

I tried the failing code with old Valhalla nightly builds and it started failing after the https://github.com/ibmruntimes/openj9-openjdk-jdk.valuetypes update in early May.

@theresa-m
Copy link
Contributor

I looked through the merge commits of these files from the May extensions update but did not see anything inconsistent with the https://github.com/ibmruntimes/openj9-openjdk-jdk repository. This list is a subset of files identified as having had conflicts in ibmruntimes/openj9-openjdk-jdk.valuetypes#10, ibmruntimes/openj9-openjdk-jdk.valuetypes#11, ibmruntimes/openj9-openjdk-jdk.valuetypes#12

src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
src/java.base/share/classes/java/lang/reflect/Modifier.java
src/java.base/share/classes/java/lang/invoke/MethodHandles.java
src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java
src/java.base/share/classes/jdk/internal/misc/Unsafe.java
src/java.base/share/classes/sun/invoke/util/Wrapper.java
src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java
src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java

@keithc-ca
Copy link
Contributor

I'm inclined to believe that openjdk hasn't finished updating the Field implementation. The usage pattern (seen in the description) should not require generation of a setter, but an override field is never considered read-only. See ReflectionFactory.java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:valhalla Used to track Project Valhalla related work triageRequired
Projects
None yet
Development

No branches or pull requests

6 participants