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

Reactive Oracle client - native build fails #24788

Closed
jsmrcka opened this issue Apr 6, 2022 · 14 comments
Closed

Reactive Oracle client - native build fails #24788

jsmrcka opened this issue Apr 6, 2022 · 14 comments
Assignees
Labels
area/mandrel kind/bug Something isn't working

Comments

@jsmrcka
Copy link
Contributor

jsmrcka commented Apr 6, 2022

Describe the bug

In an application that uses multiple reactive and JDBC clients, adding io.quarkus:quarkus-reactive-oracle-client + io.quarkus:quarkus-jdbc-oracle causes native build to fail.

...
    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-routes</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-mysql-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-pg-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-postgresql</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-db2-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-db2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-mssql-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-mssql</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-reactive-oracle-client</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-oracle</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-flyway</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-sqlserver</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-smallrye-openapi</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-hibernate-validator</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus.qe</groupId>
            <artifactId>quarkus-test-service-database</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
...

This issue looks similar to #19055.

Expected behavior

Native build passes without errors.

Actual behavior

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --rm --user 1000:1000 -v /home/jsmrcka/work/github/quarkus-qe/quarkus-test-suite/sql-db/vertx-sql/target/vertx-sql-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --name build-native-rHGfP quay.io/quarkus/ubi-quarkus-mandrel:21.3-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.mysql.cj.disableAbandonedConnectionCleanup=true -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-DQuarkusWithJcc=true -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED --trace-class-initialization=oracle.jdbc.driver.BlockSource\$ThreadedCachingBlockSource\$BlockReleaser,oracle.jdbc.driver.BlockSource\$ThreadedCachingBlockSource -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -J-Xmx4g -H:+AddAllCharsets -H:EnableURLProtocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=java.base/sun.security.action=ALL-UNNAMED --exclude-config .*com\.oracle\.database\.jdbc.* /META-INF/native-image/(?:native-image\.properties|reflect-config\.json) vertx-sql-1.0.0-SNAPSHOT-runner -jar vertx-sql-1.0.0-SNAPSHOT-runner.jar
[vertx-sql-1.0.0-SNAPSHOT-runner:57]    classlist:   6,178.12 ms,  1.19 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]        (cap):     926.04 ms,  1.19 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]        setup:   4,143.08 ms,  1.19 GB
The bundle named: com/sun/rowset/RowSetResourceBundle, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
08:59:27,826 INFO  [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.2.2.Final
08:59:53,540 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final
[vertx-sql-1.0.0-SNAPSHOT-runner:57]     (clinit):   1,640.07 ms,  2.70 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]   (typeflow):   6,250.20 ms,  2.70 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]    (objects):  82,327.07 ms,  2.70 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]   (features):   7,986.46 ms,  2.70 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]     analysis: 101,769.99 ms,  2.70 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]     universe:   7,004.56 ms,  2.90 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]      (parse):  27,081.07 ms,  3.56 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]     (inline):  22,528.38 ms,  3.46 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]    (compile):  87,516.34 ms,  3.82 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]      compile: 142,728.96 ms,  3.82 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]        image:   9,875.64 ms,  3.64 GB
[vertx-sql-1.0.0-SNAPSHOT-runner:57]        write:   1,305.71 ms,  3.64 GB
Error: Classes that should be initialized at run time got initialized during image building:
 oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'BlockSource$ThreadedCachingBlockSource$BlockReleaser.class'). oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource caused initialization of this class with the following trace: 
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.<clinit>(BlockSource.java:313)
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.<clinit>(BlockSource.java:454)

oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'BlockSource$ThreadedCachingBlockSource.class'). oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource caused initialization of this class with the following trace: 
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.<clinit>(BlockSource.java:288)
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaserListener.handleNotification(BlockSource.java:435)
	at sun.management.NotificationEmitterSupport.sendNotification(NotificationEmitterSupport.java:155)
	at sun.management.MemoryImpl.createNotification(MemoryImpl.java:161)
	at sun.management.MemoryPoolImpl$CollectionSensor.triggerAction(MemoryPoolImpl.java:326)
	at sun.management.Sensor.trigger(Sensor.java:134)


com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'BlockSource$ThreadedCachingBlockSource$BlockReleaser.class'). oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource caused initialization of this class with the following trace: 
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.<clinit>(BlockSource.java:313)
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.<clinit>(BlockSource.java:454)

oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'BlockSource$ThreadedCachingBlockSource.class'). oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource caused initialization of this class with the following trace: 
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource.<clinit>(BlockSource.java:288)
	at oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaserListener.handleNotification(BlockSource.java:435)
	at sun.management.NotificationEmitterSupport.sendNotification(NotificationEmitterSupport.java:155)
	at sun.management.MemoryImpl.createNotification(MemoryImpl.java:161)
	at sun.management.MemoryPoolImpl$CollectionSensor.triggerAction(MemoryPoolImpl.java:326)
	at sun.management.Sensor.trigger(Sensor.java:134)


	at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:555)
	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.afterImageWrite(ClassInitializationFeature.java:316)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$8(NativeImageGenerator.java:663)
	at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:73)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:663)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)

How to Reproduce?

git clone git@github.com:jsmrcka/quarkus-test-suite.git
git checkout reactive-oracle-native-reproducer
mvn clean verify -pl sql-db/vertx-sql -Dnative

Output of uname -a or ver

Linux ... 5.16.12-200.fc35.x86_64

Output of java -version

openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment Temurin-11.0.14+9 (build 11.0.14+9) OpenJDK 64-Bit Server VM Temurin-11.0.14+9 (build 11.0.14+9, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.5.Final

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

Apache Maven 3.8.4

Additional information

No response

@jsmrcka jsmrcka added the kind/bug Something isn't working label Apr 6, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 6, 2022

/cc @Karm, @galderz, @zakkak

@jsmrcka
Copy link
Contributor Author

jsmrcka commented Apr 6, 2022

@Sanne

@Sanne
Copy link
Member

Sanne commented Apr 6, 2022

I've had a quick look, it seems the Reactive Oracle Client isn't ready for native compilation. @tsegismont @cescoffier , do you have a plan or some timeline?

@cescoffier
Copy link
Member

More or less. It's not a top priority for now (mostly a bandwidth issue).
I guess we can reuse lots of the work you did. We may need a few more thing, but that would be a first step.

@Sanne
Copy link
Member

Sanne commented Apr 6, 2022

Right, at very least it should pull in the GraalVM metadata we apply in the JDBC/Oracle extension (which it's not!) - but also that's not going to be enough clearly (as this particular reproducer happens to accidentally pull in both and it still fails).

@Sanne
Copy link
Member

Sanne commented Apr 6, 2022

I'll assign to @tsegismont to track it :) No rush and feel free to reassign as needed.

@tsegismont
Copy link
Contributor

@Sanne yes, we should build on top of your efforts for the JDBC driver native compilation.

@joedevgee
Copy link

@tsegismont is there any workaround while you guys are building the solution?

@tsegismont
Copy link
Contributor

@joedevgee perhaps you could exclude the Oracle driver dependency brought transitively by quarkus-reactive-oracle-client and add a dependency to jdbc-oracle extension. I haven't tried myself, not sure it would do.

@joedevgee
Copy link

thanks for the reply @tsegismont but that doesn't seem to work. FYI my depency looks like below

implementation 'io.quarkus:quarkus-hibernate-reactive-panache'
implementation 'com.oracle.database.jdbc:ojdbc11:21.5.0.0'
implementation 'io.quarkus:quarkus-reactive-oracle-client'

native build still failed with following reason

oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource the class was requested to be initialized at run time (from jar:file:///project/lib/com.oracle.database.jdbc.ojdbc11-21.5.0.0.jar!/META-INF/native-image/native-image.properties with 'oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource'). To see why oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource got initialized use --trace-class-initialization=oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource

@Sanne
Copy link
Member

Sanne commented May 3, 2022

@joedevgee could you try adding implementation io.quarkus:quarkus-jdbc-oracle instead of com.oracle.database.jdbc:ojdbc11:21.5.0.0

@joedevgee
Copy link

joedevgee commented May 3, 2022

@joedevgee could you try adding implementation io.quarkus:quarkus-jdbc-oracle instead of com.oracle.database.jdbc:ojdbc11:21.5.0.0

already tried and failed with same error

Curretly downgrade quarkus to 2.7.5.Final and build is success, FYI

implementation 'io.quarkus:quarkus-hibernate-reactive-panache'
implementation 'io.quarkus:quarkus-reactive-oracle-client'

@tsegismont
Copy link
Contributor

Should be fixed in #25624

@jsmrcka
Copy link
Contributor Author

jsmrcka commented Jun 29, 2022

Verified with 2.10.0.Final.

@jsmrcka jsmrcka closed this as completed Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mandrel kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants