Skip to content
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

router: per data frame timeouts #1778

Closed
cdelguercio opened this issue Sep 29, 2017 · 10 comments
Closed

router: per data frame timeouts #1778

cdelguercio opened this issue Sep 29, 2017 · 10 comments
Assignees
Labels
enhancement Feature requests. Not bugs or questions.
Milestone

Comments

@cdelguercio
Copy link

When using gRPC streams, the connection times out after the route's timeout_ms is hit. Is the proper solution to make a route for only my streaming endpoints and to set timeout_ms to 0? Seems very hacky to me and the docs don't mention much about handling gRPC streams.

@mattklein123
Copy link
Member

Yeah, we don't have a great solution here today. Really the only solution right now for streams is to disable timeouts on the route. So yes, I think given the current code this is what you have to do. Ultimately, I would like to create a different type of timeout which operates at the granularity of data frames. So you can say something like: "reset if we don't get any data within X milliseconds." This would be better for streaming.

@mattklein123 mattklein123 added the question Questions that are neither investigations, bugs, nor enhancements label Sep 29, 2017
@cdelguercio
Copy link
Author

Thanks for your quick reply!

@mattklein123
Copy link
Member

I'm going to reopen this to track the feature request.

@mattklein123 mattklein123 reopened this Sep 29, 2017
@mattklein123 mattklein123 added enhancement Feature requests. Not bugs or questions. and removed question Questions that are neither investigations, bugs, nor enhancements labels Sep 29, 2017
@mattklein123 mattklein123 changed the title No docs for gRPC streams: how to handle timeout_ms router: per data frame timeouts Sep 29, 2017
@mattklein123 mattklein123 added this to the 1.5.0 milestone Oct 28, 2017
@mattklein123 mattklein123 self-assigned this Oct 28, 2017
@mattklein123 mattklein123 modified the milestones: 1.5.0, 1.6.0 Nov 3, 2017
@mattklein123 mattklein123 removed their assignment Feb 7, 2018
@mattklein123 mattklein123 modified the milestones: 1.6.0, 1.7.0 Mar 5, 2018
@mattklein123 mattklein123 modified the milestones: 1.7.0, 1.8.0 May 28, 2018
@jrajahalme
Copy link
Contributor

jrajahalme commented May 30, 2018

@mattklein123 gRPC spec (https://tools.ietf.org/html/draft-kumar-rtgwg-grpc-protocol-00) defines a timeout header grpc-timeout:

   If Timeout is omitted a server should assume an infinite timeout.
   Client implementations are free to send a default minimum timeout
   based on their deployment requirements.

Maybe router filter should detect if the request is gRPC and set the request timeout accordingly, i.e., default to infinity but use the value from the grpc-timeout field if present? Strictly speaking it is a server timeout, so maybe the proxy timeout should be marginally longer to avoid timing out while the server might still respond?

@mattklein123
Copy link
Member

@jrajahalme AFAICT from looking at that, that timeout value is also not sufficient for streaming APIs (if it is, it's not specified what the timeout actually means).

I don't have any issue with potentially supporting gRPC timeouts via header if there is a specific timeout header, but I think we should also definitely allow data frame timeouts to be specified in config since we can't trust headers for edge traffic, operators might want to override, etc.

If you are interested in implementing this please let me know. :)

@jrajahalme
Copy link
Contributor

I'm experimenting with this. Currently looking at adding support for grpc-timeout header, including defaulting to infinity for gRPC requests that are missing grpc-timeout header. Envoy-specific timeout headers override these, but timeouts from route config currently don't. Should maybe add a route config option that turns this behavior on ('use_grpc_timeout')?

@jrajahalme
Copy link
Contributor

Not sure if gRPC client libraries set grpc-timeout, though, but even the default infinity would help without splitting up routes/clusters for gRPC/other traffic.

@mattklein123
Copy link
Member

mattklein123 commented Jun 1, 2018

@jrajahalme SGTM to try that out. I would still also like to implement data frame timeouts, so if you can do that at the same time that would be awesome.

jrajahalme added a commit to jrajahalme/envoy that referenced this issue Jun 6, 2018
If the request is a gRPC request, derive the request timeout from
'grpc-timeout' header (as specified in
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md)
instead of the route configuration. This makes the timeout behavior of
a proxy to comply with the expectation of the gRPC clients so that the
timeout behavior with proxies is the same as between directly
connected client and server.

gRPC async client is modified to generate 'grpc-timeout' header when a
timeout is specified.

Fixes: envoyproxy#1778
Signed-off-by: Jarno Rajahalme <[email protected]>
@jrajahalme
Copy link
Contributor

Added support for grpc-timeout header (#3564), but not for data frame timeouts, sorry.

@htuch
Copy link
Member

htuch commented Jun 26, 2018

I'll work on implementing this over the next week.

htuch added a commit to htuch/envoy that referenced this issue Jul 11, 2018
Fixes envoyproxy#1778.

Risk level: Low (opt in).
Testing: Integration and unit tests added for various timeout scenarios.

Signed-off-by: Harvey Tuch <[email protected]>
alyssawilk added a commit that referenced this issue Jul 12, 2018
…he filter chain. (#3776)

This is the complete HTTP/1.1 implementation of #3301, new style websockets.

It should preserve existing behavior for "old style" websockets except for handling transfer-encoding requests (we all agree shouldn't happen) and responses (actually could happen and have been requested) better.

Risk Level: High (should be self contained but still lots of core code changes)
Testing: Thorough integration tests. unit tests for http1 codec
Docs Changes: added websocket FAQ
Release Notes: added

Fixes #3301 (modulo timeouts not working, which will be addressed by #3654 or #1778)

Signed-off-by: Alyssa Wilk <[email protected]>
htuch added a commit that referenced this issue Jul 16, 2018
Fixes #1778.

Risk level: Medium. A very conservative 5 minute default idle timeout has been set, which should not affect most deployments with default timeout already kicking in for connection idle or upstream idle. This will however affect things like hanging POSTs.
Testing: Integration and unit tests added for various timeout scenarios.

Signed-off-by: Harvey Tuch <[email protected]>
rshriram pushed a commit to rshriram/envoy that referenced this issue Oct 30, 2018
* implement mixer forwarding

Signed-off-by: Kuat Yessenov <[email protected]>

* hmm

Signed-off-by: Kuat Yessenov <[email protected]>

* fix the bug

Signed-off-by: Kuat Yessenov <[email protected]>

* review

Signed-off-by: Kuat Yessenov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

No branches or pull requests

4 participants