server: allow 0s grpc-timeout header values, as java is known to be able to send them#8439
server: allow 0s grpc-timeout header values, as java is known to be able to send them#8439dfawley merged 1 commit intogrpc:masterfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8439 +/- ##
==========================================
+ Coverage 82.26% 82.34% +0.07%
==========================================
Files 414 414
Lines 40410 40418 +8
==========================================
+ Hits 33243 33281 +38
+ Misses 5796 5774 -22
+ Partials 1371 1363 -8
🚀 New features to boost your workflow:
|
…ble to send them (grpc#8439)
…ble to send them (grpc#8439)
|
Please note that this change has changed the behavior of Previously, when Now, however, there's no such guarantee anymore. I wonder if it would be possible to move this early return before the inTapHandle call? |
|
The reason I put this after the intaphandle call is because that is able to change the context to one that has already expired. I'm also curious about your use case. Can you not track in-flight requests entirely within the stats handler (increment on |
|
Sorry for the delayed response, this has been sitting on my TODO list for a while. We do want to restrict parallelism, but we want a global limit, not per-client. We want to restrict the total amount of connections that the given server may handle, and |
|
Do you want to limit the total number of streams on a server across all connections? Or just the total number of connections? The latter can be accomplished by via https://pkg.go.dev/golang.org/x/net/netutil#LimitListener. You could also use interceptors instead of the tap/stats combo you are using now. That is the approach that would translate to other gRPC language implementations which don't have anything like our tap handler thing. There's a small amount of extra CPU cycles that go into interceptors vs. the tap handler, but it shouldn't be too bad. But also unless your clients are looking at the error and doing some kind of custom backoff logic, then I'm not sure the general approach is ideal. Using |
grpc/grpc-java#12201 was recently created to prevent this, but older versions will still do it. This reverts our old behavior of allowing 0 second timeouts (pre- #8290).
I would propose that we do not revert the change in http_util and allow the RPC to instantly timeout instead of throw an internal error.
cc @ejona86
RELEASE NOTES: