-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
GraphQL Batch processing throws a ContextNotActiveException #13385
Comments
Hi @funcbro , thanks for this. We know about this one. Can you test against 1.10.0 and let me know, or alternatively if you have a project example I can look at ? |
Hi @phillip-kruger, just tested the problem in 1.10.0.Final. The Exception is still thrown. Here is the Test-Project based on the 1.10.0.Final archetype: And here is the test-query:
|
Thanks ! I am look at this. |
@funcbro For now, remove |
@phillip-kruger just a little hint should you be unsure where to look - https://github.com/quarkusio/quarkus/blob/1.10.0.Final/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java#L57 this is where we activate the request context. I think the problem with batching is that the handling is performed asynchronously in different threads which don't have the request context active (it didn't go through this piece of code)? |
Yes, I just wanted to give @funcbro a "workaround". Do you want to do a fix ? |
Haven't tried but I think that if the processing is asynchronous then the annotation won't have any effect. |
Removing RequestScoped (even it if worked) is no option in my case. Might work for the test-case though. |
Not sure yet how to fix it. |
Isn't it what SmallRye Context Propagation is supposed to solve? |
Well, it's not a Quarkus-only problem. If you spawn a new thread you need to make sure the request context is (a) active or (b) propagated. For (a) you can use e.g. the |
I've started tinkering with the integration of SR Context Propagation into SR GraphQL. Hope to know more next week, it's kind of an uncharted territory for me :) |
Describe the bug
GraphQL Batch processing throws a ContextNotActiveException
Expected behavior
As described in https://quarkus.io/guides/microprofile-graphql#batching Batch processing should work =)
Actual behavior
GraphQL Batch processing throws a ContextNotActiveException
To Reproduce
See attachment for simple setup:
TestGraphQLResource.zip
Simple Source relations like the following work as expected:
When changing to Batch processing a ContextNotActiveException is thrown.
Configuration
No properties set for GraphQL
Screenshots
Environment (please complete the following information):
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
Additional context
(Add any other context about the problem here.)
The text was updated successfully, but these errors were encountered: