Open
Description
Currently grpc deadlines are propagated from client to server via grpc-timeout header as relative value(timeout).
We believe we have pretty good clock synchronization between our servers (up to several milliseconds) and are interesting in propagation of the absolute deadline in some custom header. Is there a way to do it by customizing grpc-java server and client logic in interceptors or something else, but without forking grpc-java implementation?
Activity
macrergate commentedon Mar 20, 2025
Is this the right way to go?
macrergate commentedon Mar 20, 2025
I have found another approach and it looks better than the former - using ServerStreamTracer.Factory. In this case I'm getting in before original deadline context creation in ServerImpl
Any thoughts and criticism are greatly appreciated.
kannanjgithub commentedon Mar 21, 2025
Yes, the 2nd solution is better, because in the 1st solution you are creating a forked cancellable context and so the cancellation will be called twice. Also it handles closing the call when cancellation due to the timeout occurs.
The 2nd solution just replaced the header timeout via filtering contexts and the
ServerStreamCancellationListener
will do the job of closing the call when the timeout occurs. There are no multiple contexts for the same purpose. The only caveat is that the timeout key from GrpcUtil is internal.Absolute deadline propagation grpc#11966