-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
context deadline can cause surprising errors #4196
Comments
It looks like my particular issue may be a little different than described. I was definitely seeing "timeout: no recent network activity" in my logs, which is why I thought However, it looks like the actual error that a client is much more likely to receive is an |
I'm not sure I understand under which condition exactly you expect the context cancelation error. In general, an idle timeout can occur at any time during the handshake or the connection, if the other peer suddenly goes away without telling us. There's no context being canceled here, so we shouldn't return a context cancelation error. Am I right to assume that you're setting the context on the |
Yes. That is what the standard lib For the case of the error I'm seeing, I think the HTTP/3 round tripper implementation could examine the |
Closing in favor of #4205. |
When a context deadline is added to the context of an
*http.Request
and the deadline elapses, the actual errors returned from this package can be a bit surprising. In particular, most context-deadline-checking code really would like to test errors using something likeerrors.Is(err, context.DeadlineExceed)
to ascertain if the error is due to the context deadline.However, that formulation returns false for both
quic.IdleTimeoutError
andquic.HandshakeTimeoutError
. Ideally, both of these error types would return true for this formulation via their implementation of anIs(error)
method. That is how the core runtime'snet.timeoutError
works: https://github.com/golang/go/blob/master/src/net/net.go#L600-L60. Both these types already have anIs(error)
method, but they only handle formulations likeerrors.Is(err, net.ErrClosed)
(link).This is very similar to golang/go#64449
The text was updated successfully, but these errors were encountered: