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

quarkus-reactive-routes fails when using Mutiny.SessionFactory.withSession #24037

Closed
rsvoboda opened this issue Mar 1, 2022 · 2 comments · Fixed by #24038
Closed

quarkus-reactive-routes fails when using Mutiny.SessionFactory.withSession #24037

rsvoboda opened this issue Mar 1, 2022 · 2 comments · Fixed by #24038
Assignees
Labels
area/vertx kind/bug Something isn't working
Milestone

Comments

@rsvoboda
Copy link
Member

rsvoboda commented Mar 1, 2022

Describe the bug

quarkus-reactive-routes based code fails when using Mutiny.SessionFactory.withSession

hibernate-reactive-routes-quickstart is failing since #23719 got merged
Code link https://github.com/quarkusio/quarkus-quickstarts/blob/main/hibernate-reactive-routes-quickstart/src/main/java/org/acme/hibernate/reactive/FruitsRoutes.java#L39

2022-03-01 10:27:25,791 ERROR [org.acm.hib.rea.FruitsRoutes] (vert.x-eventloop-thread-1) Failed to handle request: java.lang.IllegalStateException: The current operation requires a safe (isolated) Vert.x sub-context, but the current context hasn't been flagged as such. You can still use Hibernate Reactive, you just need to avoid using the methods which implicitly require accessing the stateful context, such as MutinySessionFactory#withTransaction and #withSession.
	at io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle.checkIsSafe(VertxContextSafetyToggle.java:80)
	at io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle.validateContextIfExists(VertxContextSafetyToggle.java:63)
	at io.quarkus.hibernate.reactive.runtime.customized.CheckingVertxContext.get(CheckingVertxContext.java:46)
	at org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl.withSession(MutinySessionFactoryImpl.java:189)
	at org.acme.hibernate.reactive.FruitsRoutes.getAll(FruitsRoutes.java:39)
...

Zulip chat - https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/hibernate-reactive-routes-quickstart/near/273641831
Conclusion: the vert.x http server didn't mark the context as safe

Expected behavior

hibernate-reactive-routes-quickstart is passing

Actual behavior

hibernate-reactive-routes-quickstart is failing

How to Reproduce?

Run hibernate-reactive-routes-quickstart

Output of uname -a or ver

macOS Monterey

Output of java -version

Java 17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

Quarkus main

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

No response

Additional information

No response

@rsvoboda rsvoboda added the kind/bug Something isn't working label Mar 1, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 1, 2022

You added a link to a Zulip discussion, please make sure the description of the issue is comprehensive and doesn't require accessing Zulip.

This message is automatically generated by a bot.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 1, 2022

/cc @cescoffier, @jponge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertx kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants