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

[GraalVM 24.0] quarkus-integration-test-hibernate-reactive-postgresql fails to compile due to vertx-sql-client issue with JDK 22 #37208

Closed
jerboaa opened this issue Nov 20, 2023 · 10 comments
Assignees
Labels
area/hibernate-reactive Hibernate Reactive area/native-image area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working

Comments

@jerboaa
Copy link
Contributor

jerboaa commented Nov 20, 2023

Describe the bug

We see the quarkus-integration-test-hibernate-reactive-postgresql native integration test failing using Mandrel 24.0 (GraalVM for JDK 22) with the following error:

========================================================================================================================
GraalVM Native Image: Generating 'quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-runner' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing...                                                                                    (8.7s @ 0.19GB)
 Java version: 22-beta+24-ea, vendor version: Mandrel-24.0.0-devc291aa4f
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: gcc (linux, x86_64, 11.4.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 7 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.quarkus.caffeine.runtime.graal.CacheConstructorsFeature
 - io.quarkus.hibernate.orm.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
 - org.hibernate.graalvm.internal.GraalVMStaticFeature: Hibernate ORM's static reflection registrations for GraalVM
------------------------------------------------------------------------------------------------------------------------
 5 experimental option(s) unlocked:
 - '-H:+AllowFoldMethods' (origin(s): command line)
 - '-H:BuildOutputJSONFile' (origin(s): command line)
 - '-H:-UseServiceLoaderFeature' (origin(s): command line)
 - '-H:IncludeResourceBundles' (origin(s): 'META-INF/native-image/org.eclipse/yasson/native-image.properties' in 'file:///home/runner/work/mandrel/mandrel/quarkus/integration-tests/hibernate-reactive-postgresql/target/quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-native-image-source-jar/lib/org.eclipse.yasson-3.0.3.jar')
 - '-H:ReflectionConfigurationResources': Use a reflect-config.json in your META-INF/native-image/<groupID>/<artifactID> directory instead. (origin(s): 'META-INF/native-image/io.netty/netty-transport/native-image.properties' in 'file:///home/runner/work/mandrel/mandrel/quarkus/integration-tests/hibernate-reactive-postgresql/target/quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-native-image-source-jar/lib/io.netty.netty-transport-4.1.100.Final.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 4.44GB of memory (28.5% of 15.61GB system memory, set via '-Xmx5g')
 - 4 thread(s) (100.0% of 4 available processor(s), determined at start)
02:18:27,709 WARN  [org.hib.orm.deprecation] HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
[2/8] Performing analysis...  []                                                                        (44.9s @ 1.00GB)
   12,267 reachable types   (80.0% of   15,336 total)
   16,108 reachable fields  (49.8% of   32,373 total)
   54,804 reachable methods (48.9% of  112,024 total)
    4,159 types,   158 fields, and 3,784 methods registered for reflection

Error: Class initialization of io.vertx.pgclient.impl.codec.DataTypeCodec failed. Use the option 

    '--initialize-at-run-time=io.vertx.pgclient.impl.codec.DataTypeCodec'

 to explicitly request initialization of this class at run time.
com.oracle.svm.core.util.UserError$UserException: Class initialization of io.vertx.pgclient.impl.codec.DataTypeCodec failed. Use the option 

    '--initialize-at-run-time=io.vertx.pgclient.impl.codec.DataTypeCodec'

 to explicitly request initialization of this class at run time.
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationSupport.ensureClassInitialized(ClassInitializationSupport.java:195)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.AllowAllHostedUsagesClassInitializationSupport.computeInitKindAndMaybeInitializeClass(AllowAllHostedUsagesClassInitializationSupport.java:191)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.AllowAllHostedUsagesClassInitializationSupport.computeInitKindAndMaybeInitializeClass(AllowAllHostedUsagesClassInitializationSupport.java:129)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationSupport.maybeInitializeAtBuildTime(ClassInitializationSupport.java:161)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationSupport.maybeInitializeAtBuildTime(ClassInitializationSupport.java:150)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.SVMHost.isInitialized(SVMHost.java:323)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisType.isInitialized(AnalysisType.java:911)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.maybeEagerlyInitialize(BytecodeParser.java:4456)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1683)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1676)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5453)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3443)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:727)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3403)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3245)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.build(BytecodeParser.java:1136)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:156)
	at jdk.graal.compiler/jdk.graal.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1028)
	at jdk.graal.compiler/jdk.graal.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:102)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:110)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.run(Phase.java:49)
	at jdk.graal.compiler/jdk.graal.compiler.phases.BasePhase.apply(BasePhase.java:435)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.graal.compiler/jdk.graal.compiler.phases.Phase.apply(Phase.java:38)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:892)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:857)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:840)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:175)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1213)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1196)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1051)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1003)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:989)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:930)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:343)
	at jdk.graal.compiler/jdk.graal.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:658)
	at jdk.graal.compiler/jdk.graal.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:893)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:73)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:194)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:605)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:152)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:110)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:114)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:575)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:478)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:169)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:154)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1726)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1717)
	at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1641)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1486)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2077)
------------------------------------------------------------------------------------------------------------------------
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2028)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Caused by: java.lang.ExceptionInInitializerError
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.classinitialization.ClassInitializationSupport.ensureClassInitialized(ClassInitializationSupport.java:177)
	... 56 more
Caused by: java.time.format.DateTimeParseException: Text '4714-11-24 00:00:00 BC' could not be parsed at index 20
	at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2108)
	at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:2010)
	at java.base/java.time.LocalDateTime.parse(LocalDateTime.java:494)
	at io.vertx.pgclient.impl.codec.DataTypeCodec.<clinit>(DataTypeCodec.java:1077)
	... 59 more
                       6.6s (11.8% of total time) in 126 GCs | Peak RSS: 1.90GB | CPU load: 3.80
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /home/runner/work/mandrel/mandrel/quarkus/integration-tests/hibernate-reactive-postgresql/target/quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-runner-build-output-stats.json (build_info)
========================================================================================================================
Finished generating 'quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-runner' in 54.8s.

See:
https://github.com/graalvm/mandrel/actions/runs/6924384895/job/18834111016#step:12:865

Root cause seems to be:

Caused by: java.time.format.DateTimeParseException: Text '4714-11-24 00:00:00 BC' could not be parsed at index 20
	at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2108)
	at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:2010)
	at java.base/java.time.LocalDateTime.parse(LocalDateTime.java:494)
	at io.vertx.pgclient.impl.codec.DataTypeCodec.<clinit>(DataTypeCodec.java:1077)
	... 59 more
                       6.6s (11.8% of total time) in 1

Output of java -version

22+24 (ea)

Quarkus version or git rev

main

@jerboaa jerboaa added the kind/bug Something isn't working label Nov 20, 2023
@quarkus-bot quarkus-bot bot added area/hibernate-reactive Hibernate Reactive area/native-image area/persistence OBSOLETE, DO NOT USE labels Nov 20, 2023
Copy link

quarkus-bot bot commented Nov 20, 2023

/cc @DavideD (hibernate-reactive), @Karm (mandrel), @Sanne (hibernate-reactive), @galderz (mandrel), @gavinking (hibernate-reactive), @zakkak (mandrel,native-image)

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 20, 2023

Note that this doesn't fail with the GraalVM CE build (using JDK 22+23). So later version of JDK 22 might be related.

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 20, 2023

This seems to affect the following native integration tests (on Mandrel 24.0):

  • Integration Tests - Hibernate Reactive - PostgreSQL
  • Integration Tests - Reactive Pg Client
  • Integration Tests - Hibernate Reactive with Panache
  • Integration Tests - Hibernate Reactive with Panache and Kotlin
  • Integration Tests - Security WebAuthn

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 20, 2023

Yes. This looks like a JDK issue:

JDK 22+23 ea:

$ ./jdk-22+23/bin/jshell -J-showversion
openjdk version "22-beta" 2024-03-19
OpenJDK Runtime Environment Temurin-22+23-202311141418 (build 22-beta+23-ea)
OpenJDK 64-Bit Server VM Temurin-22+23-202311141418 (build 22-beta+23-ea, mixed mode, sharing)
|  Welcome to JShell -- Version 22-beta
|  For an introduction type: /help intro

jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
$1 ==> -4713-11-24T00:00

jshell> 

JDK 22+24 ea

./jdk-22+24/bin/jshell -J-showversion
openjdk version "22-beta" 2024-03-19
OpenJDK Runtime Environment Temurin-22+24-202311162331 (build 22-beta+24-ea)
OpenJDK 64-Bit Server VM Temurin-22+24-202311162331 (build 22-beta+24-ea, mixed mode, sharing)
|  Welcome to JShell -- Version 22-beta
|  For an introduction type: /help intro

jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
|  Exception java.time.format.DateTimeParseException: Text '4714-11-24 00:00:00 BC' could not be parsed at index 20
|        at DateTimeFormatter.parseResolved0 (DateTimeFormatter.java:2108)
|        at DateTimeFormatter.parse (DateTimeFormatter.java:2010)
|        at LocalDateTime.parse (LocalDateTime.java:494)
|        at (#1:1)

jshell>

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 20, 2023

I've filed https://bugs.openjdk.org/browse/JDK-8320431

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 21, 2023

OK looks like this is intended behaviour - JDK 22 no longer falls back to COMPAT - and the work-around is to use Locale.US instead.

jdk-22+24/bin/jshell -J-showversion
openjdk version "22-beta" 2024-03-19
OpenJDK Runtime Environment Temurin-22+24-202311162331 (build 22-beta+24-ea)
OpenJDK 64-Bit Server VM Temurin-22+24-202311162331 (build 22-beta+24-ea, mixed mode, sharing)
|  Welcome to JShell -- Version 22-beta
|  For an introduction type: /help intro

jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.US));
$1 ==> -4713-11-24T00:00

jshell>

Who can help getting this into vertx-sql-client?

@jerboaa
Copy link
Contributor Author

jerboaa commented Nov 21, 2023

vertx sql client issue is here: eclipse-vertx/vertx-sql-client#1379

@vietj
Copy link

vietj commented Nov 30, 2023

is that a JVM bug ?

@zakkak
Copy link
Contributor

zakkak commented Dec 1, 2023

is that a JVM bug ?

Hi @vietj, (as mentioned in eclipse-vertx/vertx-sql-client#1379 (comment)) @jerboaa created a JVM bug for it and
according to the answer he got the way it was working till now was not consistent:

The new behavior is consistent with the era names that are retrieved with java.text APIs, such as SimpleDateFormat("G", Locale.ROOT) which has been returning "BCE" before this change.

So the new behavior (aka getting the exception we see) is intended.

A workaround could be to use Locale.US instead of Locale.ROOT, which has "BC" name for the Gregorian era.

zakkak added a commit to zakkak/quarkus that referenced this issue Dec 12, 2023
Workaround for quarkusio#37208 till
eclipse-vertx/vertx-sql-client#1379 gets fixed
and released

Note that the substitution only happens if necessary (i.e. it won't
happen when using JDK < 22, and it won't happen once an upstream fix
becomes available.

Closes quarkusio#37208
@jerboaa jerboaa changed the title [GraalVM 24.0] quarkus-integration-test-hibernate-reactive-postgresql fails to compile to native on latest GraalVM master [GraalVM 24.0] quarkus-integration-test-hibernate-reactive-postgresql fails to compile due to vertx-sql-client issue with JDK 22 Dec 18, 2023
@zakkak zakkak self-assigned this Dec 20, 2023
@jerboaa
Copy link
Contributor Author

jerboaa commented Jan 8, 2024

This issue got closed with #38034. We no longer see CI issues related to vertx-sql-client.

@jerboaa jerboaa closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-reactive Hibernate Reactive area/native-image area/persistence OBSOLETE, DO NOT USE kind/bug Something isn't working
Projects
None yet
3 participants