-
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
Lost context in @Blocking gRPC Service behind a GlobalInterceptor #26830
Comments
If my description is correct, I would like to add the above to the relevant docs(gRPC interceptor, |
@spencercjh sorry for the delay. |
I was able to reproduce it. |
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
@cescoffier sorry for the delay...
The best practice for gRPC is to use the Global gRPC Interceptor to handle exceptions as a last resort, but due to the problems mentioned in this issue, this operation is not feasible (under I actually wanted to write the gRPC service with the asynchronous API that Quarkus recommends more, but the gRPC and Protobuf we use are managed by Buf, not just pure protoc, so we can't generate a whole new set of gRPC code like in the documentation. Maybe we need another issue to discuss the global interceptor order under |
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local. (cherry picked from commit b82b235)
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
The problem comes from the default gRPC context storage using a thread-local. This commit overrides the storage implementation (using the recommended method) to use the duplicated context and fallback to a thread-local.
I found that Quarkus Server register
io.quarkus.grpc.runtime.supports.blocking.BlockingServerInterceptor
for each blocking gRPC service with the@Blocking
annotation before it starts.If some global interceptors (with
@GlobalInterceptor
) set the Context value will not work. TheContext
will still be empty in the actual rpc method handler.Is it a normal phenomenon because
Context
should be placed afterBlockingServerInterceptor
'svert.x.executeBlocking
? There are some associated issues: #14665, #13959.Finally, I replace the
@GlobalInterceptor
with@RegisterInterceptor(MyInterceptor.class)
, and everything is to be ok which seems to prove my point.I don't particularly understand the technical details of it, and these are what I got from trying and debugging. I've been only using Spring and Micronaut before.
origin question:
https://stackoverflow.com/questions/73039706/lost-context-in-blocking-grpc-service-with-quarkus-behind-a-globalinterceptor
The text was updated successfully, but these errors were encountered: