Skip to content

Conversation

@DavideD
Copy link
Contributor

@DavideD DavideD commented Apr 8, 2025

Fix #46917

@quarkus-bot

This comment has been minimized.

@yrodiere
Copy link
Member

yrodiere commented Apr 9, 2025

Thanks for the PR. Could you please link issues fixed by this PR? (Adding Fixes #1234 in the description) EDIT: Sorry, you already did that, my bad.

Also, obviously, CI is failing :) Could you have a look? It look like a Java Service needs to be registered:

[INFO] 	
[INFO] -------------------------------------------------------	
[INFO]  T E S T S	
[INFO] -------------------------------------------------------	
[INFO] Running io.quarkus.it.hibernate.reactive.postgresql.HibernateReactiveFetchLazyInGraalIT	
Executing "/home/runner/_work/quarkus/quarkus/integration-tests/hibernate-reactive-postgresql/target/quarkus-integration-test-hibernate-reactive-postgresql-999-SNAPSHOT-runner -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/home/runner/_work/quarkus/quarkus/integration-tests/hibernate-reactive-postgresql/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.log.category."io.quarkus".level=INFO -Dquarkus.profile=prod -Dquarkus.native.container-build=true -Dquarkus.native.native-image-xmx=6g"	
Apr 08, 2025 4:31:16 PM io.quarkus.runtime.ApplicationLifecycleManager run	
ERROR: Failed to start application	
java.lang.RuntimeException: Failed to start quarkus	
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)	
	at io.quarkus.runtime.Application.start(Application.java:101)	
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:119)	
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:80)	
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:51)	
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:144)	
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)	
Caused by: java.util.ServiceConfigurationError: io.vertx.core.spi.VertxServiceProvider: Provider org.hibernate.reactive.context.impl.ContextualDataStorage not found	
	at [email protected]/java.util.ServiceLoader.fail(ServiceLoader.java:593)	
	at [email protected]/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)	
	at [email protected]/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)	
	at [email protected]/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)	
	at [email protected]/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)	
	at [email protected]/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)	
	at io.vertx.core.ServiceHelper.loadFactories(ServiceHelper.java:57)	
	at io.vertx.core.ServiceHelper.loadFactories(ServiceHelper.java:44)	
	at io.vertx.core.impl.VertxBuilder.init(VertxBuilder.java:274)	
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:245)	
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:698)	
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$VertxSupplier.get(VertxCoreRecorder.java:677)	
	at io.quarkus.vertx.http.runtime.VertxHttpRecorder.initializeRouter(VertxHttpRecorder.java:324)	
	at io.quarkus.runner.recorded.VertxHttpProcessor$preinitializeRouter1141331088.deploy_0(Unknown Source)	
	at io.quarkus.runner.recorded.VertxHttpProcessor$preinitializeRouter1141331088.deploy(Unknown Source)	
	... 7 more

Thanks.

@DavideD
Copy link
Contributor Author

DavideD commented Apr 9, 2025

Mmmh... I have no idea what I need to do to solve this.
We added this service implementation here: hibernate/hibernate-reactive#2198

Hibernate Reactive implements the VertxServiceProvider from Vert.x.
Where should I register this so that Quarkus is happy?

@yrodiere
Copy link
Member

yrodiere commented Apr 9, 2025

Where should I register this so that Quarkus is happy?

It's not Quarkus, it's GraalVM. Native compilation requires that you register services that should be made available at runtime. It's basically just like reflection -- and in a way, Java Services are reflection.

Go to extensions/hibernate-orm/deployment, do CTRL+SHIFT+F "service", and you'll find this:

@BuildStep
NativeImageFeatureBuildItem registerServicesForReflection(BuildProducer<ServiceProviderBuildItem> services) {
for (DotName serviceProvider : ClassNames.SERVICE_PROVIDERS) {
services.produce(ServiceProviderBuildItem.allProvidersFromClassPath(serviceProvider.toString()));
}
return new NativeImageFeatureBuildItem(RegisterServicesForReflectionFeature.class);
}

You would need something similar in Hibernate Reactive.

@yrodiere
Copy link
Member

yrodiere commented Apr 9, 2025

You would need something similar in Hibernate Reactive.

By the way, I meant you need something similar to the first part (ServiceProviderBuildItem), not to the second (GraalVM "Feature").
Also, you may want to be more conservative. I'm not sure you need to register all providers if this is a vertx contract. Maybe you want to register the Hibernate Reactive one only.

@gsmet
Copy link
Member

gsmet commented Apr 9, 2025

@DavideD let me know if you want me to take care of it!

@DavideD
Copy link
Contributor Author

DavideD commented Apr 9, 2025

@DavideD let me know if you want me to take care of it!

Thanks @gsmet,
I will give it a go, but I will ping you if I cannot figure it out

@yrodiere
Copy link
Member

yrodiere commented Apr 9, 2025

Also, you may want to be more conservative. I'm not sure you need to register all providers if this is a vertx contract. Maybe you want to register the Hibernate Reactive one only.

:]

@DavideD
Copy link
Contributor Author

DavideD commented Apr 9, 2025

What do you mean? I only copied the class name, but the list contains only the Vert.x Provider:

   public static final List<DotName> SERVICE_PROVIDERS = List.of(
            // This is a Vert.x service that it's used in in org.hibernate.reactive.context.impl.VertxContext#contextualDataMap
            createConstant( "io.vertx.core.spi.VertxServiceProvider" )
    );

Or did you mean something else?

@quarkus-bot

This comment has been minimized.

@DavideD
Copy link
Contributor Author

DavideD commented Apr 9, 2025

Ah, you refer to the call to allProvidersFromClassPath, got it (I think)

@DavideD DavideD force-pushed the hibernate-reactive-2.4.6.Final branch 2 times, most recently from 7df2782 to 4502285 Compare April 9, 2025 11:04
@quarkus-bot quarkus-bot bot added area/arc Issue related to ARC (dependency injection) area/graphql area/maven area/smallrye labels Apr 9, 2025
@quarkus-bot

This comment has been minimized.

@DavideD DavideD force-pushed the hibernate-reactive-2.4.6.Final branch from 4502285 to ded306f Compare April 9, 2025 11:28
Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@quarkus-bot

This comment has been minimized.

@DavideD DavideD force-pushed the hibernate-reactive-2.4.6.Final branch 2 times, most recently from ef6ef4b to 45f5eaa Compare April 9, 2025 11:40
@quarkus-bot

This comment has been minimized.

@DavideD DavideD force-pushed the hibernate-reactive-2.4.6.Final branch from 45f5eaa to c273c13 Compare April 9, 2025 12:30
@yrodiere yrodiere added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Apr 9, 2025
@quarkus-bot

This comment has been minimized.

@DavideD DavideD force-pushed the hibernate-reactive-2.4.6.Final branch from c273c13 to 9c32432 Compare April 9, 2025 12:45
@gsmet
Copy link
Member

gsmet commented Apr 9, 2025

@DavideD https://github.com/quarkusio/quarkus/blob/main/CONTRIBUTING.md#using-aliases might be of help. The format alias is extremely handy and fast to solve formatting issues.

@quarkus-bot

This comment has been minimized.

@yrodiere
Copy link
Member

  • Failing: integration-tests/observability-lgtm

This seems to be failing all over the place in other PRs... I'll rebase on main and see what happens.

Hibernate Reactive now implements a service from Vert.x that
needs to be registered.

Service name  : `io.vertx.core.spi.VertxServiceProvider`
Implementation: `org.hibernate.reactive.context.impl.ContextualDataStorage`
@yrodiere yrodiere force-pushed the hibernate-reactive-2.4.6.Final branch from 9c32432 to 55eb518 Compare April 10, 2025 07:30
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 10, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 55eb518.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/infinispan-cache/deployment

io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls - History

  • expected: "thread1" but was: "thread2" - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: 

expected: "thread1"
 but was: "thread2"
	at io.quarkus.cache.infinispan.InfinispanCacheTest.testGetAsyncWithParallelCalls(InfinispanCacheTest.java:283)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.test.QuarkusUnitTest.runExtensionMethod(QuarkusUnitTest.java:521)
	at io.quarkus.test.QuarkusUnitTest.interceptTestMethod(QuarkusUnitTest.java:435)

📦 extensions/scheduler/deployment

io.quarkus.scheduler.test.timezone.TriggerPrevFireTimeZoneTest.testScheduledJobs - History

  • expected: <true> but was: <false> - org.opentest4j.AssertionFailedError
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:183)
	at io.quarkus.scheduler.test.timezone.TriggerPrevFireTimeZoneTest.testScheduledJobs(TriggerPrevFireTimeZoneTest.java:61)

@gsmet gsmet merged commit 6aadde9 into quarkusio:main Apr 10, 2025
56 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.22 - main milestone Apr 10, 2025
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Apr 10, 2025
@gsmet
Copy link
Member

gsmet commented Apr 10, 2025

Thanks! Will backport it in the next backport round.

@gsmet gsmet modified the milestones: 3.22 - main, 3.21.3 Apr 15, 2025
@gsmet
Copy link
Member

gsmet commented May 6, 2025

Let's make sure we bump to 2.4.7 when we include this one in 3.20.

@gsmet gsmet modified the milestones: 3.21.3, 3.20.1 May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hibernate Reactive eager fetching the wrong record for ManyToOne

3 participants