-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix for deactivating managed context in GraphQL server #27040
Conversation
bf000e0
to
27e6a8b
Compare
Signed-off-by: Phillip Kruger <[email protected]>
27e6a8b
to
308aae0
Compare
Failing Jobs - Building 308aae0
Full information is available in the Build summary check run. Failures⚙️ Gradle Tests - JDK 11 #- Failing: integration-tests/gradle
📦 integration-tests/gradle✖
|
@@ -67,6 +68,7 @@ public void handle(final RoutingContext ctx) { | |||
} | |||
try { | |||
handleWithIdentity(ctx); | |||
currentManagedContext.deactivate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this one in a finally? Why deactivate in one case and terminate in the case of an exception?
Also what's the purpose of this.currentManagedContextTerminationHandler now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.currentManagedContextTerminationHandler
will terminate (so deactivate and destroy) once we are done, while the deactivate after the handleWithIdentity
will only deactivate (so that it does not leak)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not need to be in a finally as the catch with terminate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can understand that but my concern was more that we are not consistent. Typically here: https://github.com/quarkusio/quarkus/pull/27040/files#diff-5b5cda47e6a5418c9345a577d468f058e05c412dc9b64fce6a6ef5aec496023bR75-R85 where we simply deactivate. Or maybe the exception from the latter is caught below?
Also what do you mean by leaking? What I don't understand is how we can leak something between this and the end of the response? Or is it that the thread is somehow reused between the end of this and the end of the response?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thread could be reused, in a high traffic scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you're sure that all the response handlers we added earlier are always executed on the right thread at the right time?
That's what gets me a bit worried.
Note that I have no idea how this all works so I'm asking naive questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure. Maybe @stuartwdouglas can explain better. By leaking I mean that a new request that use the same thread can get the context that still float around (because it's not been deactivated)
Fix #27036
Signed-off-by: Phillip Kruger [email protected]