-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/net/http2: make Transport occasionally send PING frames to server #31643
Comments
clientConnPool
periodically send ping fame to peerclientConnPool
periodically send ping frame to peer
clientConnPool
periodically send ping frame to peer
/cc @fraenkel |
@bradfitz One idea would be to have a If we want this baked into the clientConnPool, we currently have no good way to pass additional information forward, e.g. ping interval. While this is a client->server issue, does anyone ever do server -> client initiated? |
Change https://golang.org/cl/173952 mentions this issue: |
@fraenkel in what situations server->client would be used? I am not sure about if it would be useful for server push connections. |
@szuecs This is partially about supporting the http/2 spec which allows either endpoint to initiate a ping. A server may want to know if a client is no longer responsive. Today a server relies on the connection being severed but there are many cases where a connection remains active but the client is no longer present, e.g., proxies, or unresponsive. A PING provides an alternative way. |
@fraenkel so instead of CloseIdleConnections a proxy could use PING, instead. Thanks |
We should probably send occasional PINGs by default on idle connections (configurable, including off), but to get fancier we could also we could send a PING along with any HEADERS if it's been more than some certain threshold duration since the last PING. We can then retry the request on a new connection if we don't get a PING response back soon. We can only do that safely with idempotent+replayable (bodyless or Request.GetBody != nil) so for others (e.g. POST without GetBody) we could do the PING first over a certain threshold and just pay the extra RTT cost. But probably easiest to start with just occasional PINGs. |
I'll work on a patch. [Update] WIP |
connection if the ping is not responded on time. DO NOT SUBMIT Updates golang/go#31643
Change https://golang.org/cl/198040 mentions this issue: |
After the connection has been idle for a while, periodic pings are sent over the connection to check its health. Unhealthy connection is closed and removed from the connection pool. Updates golang/go#31643
After the connection has been idle for a while, periodic pings are sent over the connection to check its health. Unhealthy connection is closed and removed from the connection pool. Fixes golang/go#31643
After the connection has been idle for a while, periodic pings are sent over the connection to check its health. Unhealthy connection is closed and removed from the connection pool. Fixes golang/go#31643
After the connection has been idle for a while, periodic pings are sent over the connection to check its health. Unhealthy connection is closed and removed from the connection pool. Fixes golang/go#31643
Change https://golang.org/cl/238721 mentions this issue: |
Change https://golang.org/cl/249842 mentions this issue: |
Updates x/net/http2 to git rev c89045814202410a2d67ec20ecf177ec77ceae7f http2: perform connection health check https://golang.org/cl/198040 (fixes #31643) http2: use ASCII space trimming for parsing Trailer header https://golang.org/cl/231437 all: update golang.org/x/crypto to v0.0.0-20200622213623-75b288015ac9 https://golang.org/cl/239700 (updates #30965) net/http2: fix erringRoundTripper https://golang.org/cl/243257 (updates #40213) also updates the vendored version of golang.org/x/net as per $ go get golang.org/x/net@c890458142 $ go mod tidy $ go mod vendor $ go generate -run bundle std Change-Id: Iea2473ef086df760144d9656f03a0218eb9da91f Reviewed-on: https://go-review.googlesource.com/c/go/+/249842 Run-TryBot: Emmanuel Odeke <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
Change https://golang.org/cl/258538 mentions this issue: |
After the connection has been idle for a while, periodic pings are sent over the connection to check its health. Unhealthy connection is closed and removed from the connection pool. Fixes golang/go#31643 Change-Id: Idbbc9cb2d3e26c39f84a33e945e482d41cd8583c GitHub-Last-Rev: 36607fe185ce6684e9900403f82a298ad5567650 GitHub-Pull-Request: golang/net#55 Reviewed-on: https://go-review.googlesource.com/c/net/+/198040 Run-TryBot: Andrew Bonventre <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Nowadays, the
ClientConn
inx/net/http2
package has supported to send ping frame to peer, but the related defaultclientConnPool
doesn't support this feature andclientConnPool
is an internal struct, we couldn't reuse this struct and add our own logic, As a result, If we want all connections in a connection pool to send ping fame to keep connection alive and identify failed connections, we must implement a new customized connpool, which seems a hard work to do.IMHO, maybe we should add support in default
clientConnPool
to let all connection periodically send ping fame to peer?What did you expect to see?
add support in default
clientConnPool
to let all connection periodically send ping fame to peer?What did you see instead?
The text was updated successfully, but these errors were encountered: