-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Hibernate Reactive with Stage API throws ContextNotActiveException on flush #14812
Comments
/cc @DavideD, @Sanne, @gavinking |
Discussed with @DavideD (https://hibernate.zulipchat.com/#narrow/stream/205413-hibernate-reactive-dev/topic/Flush.20with.20stage.20API.20in.20Quarkus). He'll have a look when he has some time. |
See quarkusio#14812 Signed-off-by: Yoann Rodière <yoann@hibernate.org>
FWIW, I have a different error; perhaps this is the underlying cause?
|
@Sanne That's weird, I don't have this error... Anyway. I thought |
Same for me. And when I debug, everything seems in the right Thread |
I spent days despairing over reactive services not working in Quarkus tests. They only worked if called starting from the controller via RestAssured or other such rest simulator. Eventually I got lucky and was able to inject a Mutiny.SessionFactory into the test:
And inside the test method itself, wrap it in a withSession:
|
(Note: I edited the first line, it was misleading) I suspect that injected sessions can only work properly when accessed from the original thread that activated the request context (be it the test thread or the VertX even loop thread). When we call
With Mutiny however, it seems all the calls are performed in the original thread T1. I don't know why. This works, but I think it may be wrong, since I believe everything should be executed in the VertX event loop? @DavideD could this possibly be what's happening? Maybe something similar? |
See quarkusio#14812 Signed-off-by: Yoann Rodière <yoann@hibernate.org> (cherry picked from commit 675c417)
It sounds like Mutiny is propagating the request scope but the CompletionStage API is not. |
Last time I checked, the mutiny API was executing everything in the
original thread. So it didn't even need to propagate the context.
Le mar. 9 févr. 2021 à 06:14, Stuart Douglas <notifications@github.com> a
écrit :
… It sounds like Mutiny is propagating the request scope but the
CompletionStage API is not.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14812 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADEZTUYQEEBXJ7MUP6NOX3S6DACNANCNFSM4XCMOYZQ>
.
|
Mutiny has built-in propagation. CompletionStage does not have that. |
Describe the bug
The code below throws a
ContextNotActiveException
(see also reproducer below). Switching to the Mutiny API makes the problem disappear.Stack trace:
Expected behavior
I would expect the Mutiny API and the Stage API to behave similarly. Maybe the code is wrong, but in that case both APIs should throw an exception?
Actual behavior
(Describe the actual behavior clearly and concisely.)
To Reproduce
See this branch where I added two tests: one with the Mutiny API and another with the Stage API. The Munity test passes, but the Stage one fails.
Configuration
N/A
Screenshots
N/A
Environment (please complete the following information):
uname -a
orver
:Linux yrodiere.redhat 5.10.8-100.fc32.x86_64 #1 SMP Sun Jan 17 19:52:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
java -version
:mvnw --version
orgradlew --version
):Additional context
N/A
The text was updated successfully, but these errors were encountered: