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

[24.0] Undefined reference to `Java_java_lang_VirtualThread_notifyJvmtiDisableSuspend' with JDK 22+31 #661

Closed
zakkak opened this issue Jan 16, 2024 · 13 comments
Assignees
Labels

Comments

@zakkak
Copy link
Collaborator

zakkak commented Jan 16, 2024

Description

We see CI failures due to

/usr/bin/ld: quarkus-runner.o:(.data+0x8f8): undefined reference to `Java_java_lang_VirtualThread_notifyJvmtiDisableSuspend'

The new method was introduced with a backport of https://bugs.openjdk.org/browse/JDK-8311218 in JDK 22+31

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 16, 2024

Fixed upstream in oracle#8140 and backported to 24.0 with oracle@96e2820 and oracle@bb02595

Rebasing mandrel/24.0 on upstream.

CI testing the rebase https://github.com/graalvm/mandrel/actions/runs/7538951835

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 16, 2024

It still seems there?



java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Linker command executed:
/usr/bin/gcc -z noexecstack -z notext -Wl,--gc-sections -Wl,--version-script,/tmp/SVM-17114105268133201453/exported_symbols.list -Wl,-x -o /home/runner/work/mandrel/mandrel/quarkus/integration-tests/main/target/quarkus-integration-test-main-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-main-999-SNAPSHOT-runner quarkus-integration-test-main-999-SNAPSHOT-runner.o /home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libnet.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libextnet.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libnio.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libjava.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libzip.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64/libjvm.a -Wl,--export-dynamic -v -L/tmp/SVM-17114105268133201453 -L/home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc -L/home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64 -ldl -lpthread -lz -lrt -Wl,-u,JNU_CallMethodByName -Wl,-u,JNU_CallStaticMethodByName -Wl,-u,JNU_GetEnv -Wl,-u,JNU_GetStaticFieldByName -Wl,-u,JNU_GetStringPlatformChars -Wl,-u,JNU_IsInstanceOfByName -Wl,-u,JNU_NewObjectByName -Wl,-u,JNU_NewStringPlatform -Wl,-u,JNU_ReleaseStringPlatformChars -Wl,-u,JNU_SetFieldByName -Wl,-u,JNU_ThrowArrayIndexOutOfBoundsException -Wl,-u,JNU_ThrowByName -Wl,-u,JNU_ThrowIllegalArgumentException -Wl,-u,JNU_ThrowInternalError -Wl,-u,JNU_ThrowNullPointerException -Wl,-u,JNU_ThrowOutOfMemoryError -Wl,-u,JNI_CreateJavaVM -Wl,-u,JNI_GetCreatedJavaVMs -Wl,-u,JNI_GetDefaultJavaVMInitArgs -Wl,-u,jio_fprintf -Wl,-u,jio_snprintf -no-pie

Linker command output:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.4.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-XeT9lY/gcc-11-11.4.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/11/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/11/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-z' 'noexecstack' '-z' 'notext' '-o' '/home/runner/work/mandrel/mandrel/quarkus/integration-tests/main/target/quarkus-integration-test-main-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-main-999-SNAPSHOT-runner' '-v' '-L/tmp/SVM-17114105268133201453' '-L/home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc' '-L/home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64' '-no-pie' '-mtune=generic' '-march=x86-64' '-dumpdir' '/home/runner/work/mandrel/mandrel/quarkus/integration-tests/main/target/quarkus-integration-test-main-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-main-999-SNAPSHOT-runner.'
 /usr/lib/gcc/x86_64-linux-gnu/11/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper -plugin-opt=-fresolution=/tmp/cczeICBE.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o /home/runner/work/mandrel/mandrel/quarkus/integration-tests/main/target/quarkus-integration-test-main-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-main-999-SNAPSHOT-runner -z noexecstack -z notext /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbegin.o -L/tmp/SVM-17114105268133201453 -L/home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc -L/home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64 -L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. --gc-sections --version-script /tmp/SVM-17114105268133201453/exported_symbols.list -x quarkus-integration-test-main-999-SNAPSHOT-runner.o /home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64/liblibchelper.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libnet.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libextnet.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libnio.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libmanagement_ext.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libjava.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/static/linux-amd64/glibc/libzip.a /home/runner/work/mandrel/mandrel/graalvm-home/lib/svm/clibraries/linux-amd64/libjvm.a --export-dynamic -ldl -lpthread -lz -lrt -u JNU_CallMethodByName -u JNU_CallStaticMethodByName -u JNU_GetEnv -u JNU_GetStaticFieldByName -u JNU_GetStringPlatformChars -u JNU_IsInstanceOfByName -u JNU_NewObjectByName -u JNU_NewStringPlatform -u JNU_ReleaseStringPlatformChars -u JNU_SetFieldByName -u JNU_ThrowArrayIndexOutOfBoundsException -u JNU_ThrowByName -u JNU_ThrowIllegalArgumentException -u JNU_ThrowInternalError -u JNU_ThrowNullPointerException -u JNU_ThrowOutOfMemoryError -u JNI_CreateJavaVM -u JNI_GetCreatedJavaVMs -u JNI_GetDefaultJavaVMInitArgs -u jio_fprintf -u jio_snprintf -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/11/crtend.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: quarkus-integration-test-main-999-SNAPSHOT-runner.o:(.data+0xc78): undefined reference to `Java_java_lang_VirtualThread_notifyJvmtiDisableSuspend'
collect2: error: ld returned 1 exit status
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:201)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:732)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:537)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:526)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:701)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:140)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:95)

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 16, 2024

Running with -Djdk.graal.PrintIntrinsics=true I see that java.lang.VirtualThread.notifyJvmtiDisableSuspend(boolean) is indeed being registered, but the intrinsification still fails apparently. It's still not clear to me why.

Upstream seems to still build against 22+27 while the latest labsjdk 22 build is 22+29. So the issue is probably present in upstream as well.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 17, 2024

Running with -Djdk.graal.PrintIntrinsics=true I see that java.lang.VirtualThread.notifyJvmtiDisableSuspend(boolean) is indeed being registered, but the intrinsification still fails apparently. It's still not clear to me why.

Upstream seems to still build against 22+27 while the latest labsjdk 22 build is 22+29. So the issue is probably present in upstream as well.

Did you report this upstream yet?

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 17, 2024

Did you report this upstream yet?

No, I am not sure what would be the value of reporting this upstream at the moment.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 17, 2024

#661 (comment) mentions that the back-ports are supposed to fix this problem for 22+31, correct? They don't. If that's the case isn't it worth asking/reporting this upstream? Up to you, though.

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 18, 2024

@gilles-duboscq FYI: It looks like the backport of oracle#8140 is not enough to build with JDK 22+31. Is there any ETA on when you plan to bump labsjdk to 22+31 for the release/graal-vm/24.0 branch?

Thanks

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 18, 2024

I've filed oracle#8195 for this.

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 19, 2024

@jerboaa I have cherry picked oracle@944f5d1 in https://github.com/graalvm/mandrel/tree/mandrel/24.0 to temporarily (the cherry-pick will be dropped once backported on upstream) work around oracle#8195 and be able to get some more meaningful test results.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 22, 2024

@jerboaa I have cherry picked oracle@944f5d1 in https://github.com/graalvm/mandrel/tree/mandrel/24.0 to temporarily (the cherry-pick will be dropped once backported on upstream) work around oracle#8195 and be able to get some more meaningful test results.

OK, thanks! I'll close this as we have better CI results by now showing that this issue is no longer there:
#644 (comment)

@jerboaa jerboaa closed this as completed Jan 22, 2024
@zakkak
Copy link
Collaborator Author

zakkak commented Jan 22, 2024

OK, thanks! I'll close this as we have better CI results by now showing that this issue is no longer there:
#644 (comment)

I prefer to keep this open till the fix gets backported upstream as well. The cherry pick was mostly to get the CI working again. In the highly unlikely case that upstream doesn't get a backport to fix this, we will need a proper backport PR to close this issue (but since the branch is far from stable at this point I prefer to keep the rebase/force-push approach with work-arounds cherry-picked on top for the time being, happy to discuss alternatives though).

@zakkak zakkak reopened this Jan 22, 2024
@jerboaa
Copy link
Collaborator

jerboaa commented Jan 23, 2024

Sure.

@zakkak
Copy link
Collaborator Author

zakkak commented Jan 23, 2024

Fix merged upstream in 24.0 as part of oracle@77f95e2

I have rebased mandrel/24.0 and dropped my cherry pick. Closing this.

@zakkak zakkak closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants