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

Native build image failure: oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource still failing on mandrel image (jdk 21) #36854

Closed
Jacopo47 opened this issue Nov 3, 2023 · 3 comments
Labels

Comments

@Jacopo47
Copy link

Jacopo47 commented Nov 3, 2023

Describe the bug

While building an application with jdk 21 that has io.quarkus:quarkus-jdbc-oracle extension the build fails due to the following error:

The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call th
em explicitly from your main entry point.
Detailed message:
Trace: Object was reached by
  trying to constant fold static field oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.SOLE_INSTANCE
    at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.stopBlockReleaserThread(BlockSource.java:298)
  parsing method oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.stopBlockReleaserThread(BlockSource.java:298) reachable via the parsing context
    at static root method.(Unknown Source)


        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:814)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:538)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:720)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. Thread name: oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser. Threads running in the image generator are no longer runn
ing at image runtime. If these objects should not be stored in the image heap, you can use

    '--trace-object-instantiation=oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser'

to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with

    '--initialize-at-run-time=<culprit>'

to prevent the instantiation of the object.

The issue seems very similar to what was described and solved here: #27246
but I'm still facing it.

Quarkus version: 3.2.7.Final

> java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)
> native-image --version
native-image 21.0.1 2023-10-17
OpenJDK Runtime Environment Mandrel-23.1.1.0-Final (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Mandrel-23.1.1.0-Final (build 21.0.1+12-LTS, mixed mode)

Expected behavior

I expected the build to complete without explicitly specify (as it's working with jdk 17):

--initialize-at-run-time=oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource

Actual behavior

No response

How to Reproduce?

  1. Follow the getting started: https://quarkus.io/guides/getting-started
  2. add oralce jdbc extension: > ./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-jdbc-oracle"
  3. execute native build: > ./mvnw clean verify -Pnative -Dquarkus.container-image.build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21

Output of uname -a or ver

No response

Output of java -version

openjdk version "21.0.1" 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)

Mandrel or GraalVM version (if different from Java)

native-image 21.0.1 2023-10-17 OpenJDK Runtime Environment Mandrel-23.1.1.0-Final (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Mandrel-23.1.1.0-Final (build 21.0.1+12-LTS, mixed mode)

Quarkus version or git rev

3.2.7-Final

Build tool (ie. output of mvnw --version or gradlew --version)

apache-maven-3.9.5

Additional information

No response

@Jacopo47 Jacopo47 added area/native-image kind/bug Something isn't working labels Nov 3, 2023
Copy link

quarkus-bot bot commented Nov 3, 2023

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel)

@zakkak
Copy link
Contributor

zakkak commented Nov 3, 2023

@Jacopo47 Quarkus 3.2.7.Final is not compatible with Mandrel 23.1.x or GraalVM for JDK 21, please use Mandrel 23.0.2.1-Final (or Quarkus' default builder image)

@Jacopo47
Copy link
Author

Hi @zakkak , thank you for your feedback!!

Since I'm working on moving to java 21 I updated to Quarkus 3.5.1 and everything is working fine.

Thanks again!

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