-
Notifications
You must be signed in to change notification settings - Fork 353
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
Implements route backend timeout #1566
Conversation
f4bce3e
to
a01f7a0
Compare
If response truncation is not acceptable I see three ways out:
|
be61996
to
20b44c0
Compare
/cc @otrosien |
10795e8
to
d3af5cd
Compare
There is a general problem to notify client about backend that has stuck. At the moment Lines 411 to 421 in 8f32650
which leads to truncated response.
|
I believe this is possible if we implement our variant of context.Context and signal to it various phases like request headers sent, request stream done, response headers received, response stream done. But in my opinion, the current implementation is a good start, and covers a reasonable majority of the use cases. |
I would allow multiple filters where the last one would take effect (see my comment for the |
d3af5cd
to
72f8105
Compare
Code looks good to me. |
72f8105
to
c75314f
Compare
This comment has been minimized.
This comment has been minimized.
c75314f
to
7d6e3a2
Compare
7d6e3a2
to
eeba310
Compare
if cerr := req.Context().Err(); cerr != nil { | ||
ctx.proxySpan.LogKV("event", "error", "message", cerr.Error()) | ||
return nil, &proxyError{err: cerr, code: 499} | ||
if cerr == stdlibcontext.Canceled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now covers client cancellation and backend request timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
eeba310
to
e7a40ea
Compare
e7a40ea
to
1aa946b
Compare
* Adds `backendTimeout` filter to configure route backend timeout * Proxy sets up request context with configured timeout and responds with 504 status on timeout (note: if response streaming has already started it will be terminated, client will receive backend status and truncated response body) See zalando#1041 Signed-off-by: Alexander Yastrebov <[email protected]>
1aa946b
to
2bd0526
Compare
I have rebased and updated tests as suggested |
👍 |
Thanks a lot! |
👍 |
backendTimeout
filter to configure route backend timeoutwith 504 status on timeout (note: if response streaming has already
started it will be terminated, client will receive backend status and
truncated response body).
See #1041