-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/http2: transport.CloseIdleConnections() does not have any effect #14607
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
Comments
I've investigated this further and when running a Docker instance on my computer (MacBook Pro) I can't reproduce the timeout issue, but it does occur regularly on my Kubernetes pod (on Google Container Engine), so it's probably because the Go sockets can't detect that they've been shut down by Google Cloud's keep-alive timeout of 10 minutes. Something is still not right with I've attached the full set of logs (kubelogs.txt) from my Kubernetes pod showing how requests work and then after a while start failing with timeouts (the While this issue is for |
Sorry for the delay. I see the problem. Looks like an easy fix. |
CL https://golang.org/cl/23258 mentions this issue. |
…together Go 1.6+ wires up its http.Transport values to http2 with ConfigureTransport. ConfigureTransport sets the connection pool to a "noDialClientConnPool" type. But the Transport.CloseIdleConnections implementation was specifically looking for a concrete type. Look for an interface instead. Updates golang/go#14607 (needs bundle into the main repo before fix) Change-Id: I6ad23b6facab5d3c2cbe71a1809a52794375d803 Reviewed-on: https://go-review.googlesource.com/23258 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
CL https://golang.org/cl/23280 mentions this issue. |
I'm writing a service that delivers notifications to Apple's APNS service via their HTTP/2 API. For some reason APNS stops caring about an HTTP/2 connection after a certain amount of time of idling. The problem is that HTTP/2 connections are retained in the client pool, and they eventually become unusable because they are 100% guaranteed to time out once APNS stops caring about them. Despite this, they're not removed from the HTTP/2 client pool which means my service is rendered unusable.
Initially I was thinking of keeping the connection alive by pinging, but I'm unable to find a way to send PING frames with the Go HTTP library, so what I tried to do instead is to kill idle connections and reestablish them later (since this should be a fairly rare occurrence anyway). However, it appears that calling
CloseIdleConnections()
on theTransport
instance does nothing. See example below with relevant code + log entries.(Note that using an invalid device token in this example is intentional.)
(I'm using
go version go1.6 darwin/amd64
)The text was updated successfully, but these errors were encountered: