Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upx/net/http2: expose CloseIfIdle and ClientConnPoolIdleCloser #17775
Comments
This comment has been minimized.
This comment has been minimized.
CL https://golang.org/cl/32326 mentions this issue. |
This comment has been minimized.
This comment has been minimized.
@bradfitz: any interest for this PR? |
This comment has been minimized.
This comment has been minimized.
I am on leave for a couple months, so I'll let @tombergan handle this. But I do not think it's a good idea to expose tons of innards of http2. That constrains us in the future. I'd rather see this bug phrased in terms of the problem rather than the solution. |
This comment has been minimized.
This comment has been minimized.
We are implementing our own But we could have our pool handling idle connections by itself, without relying on this |
This comment has been minimized.
This comment has been minimized.
This seems entirely reasonable. http2.Transport.CloseIdleConnections() is a no-op when the transport uses a custom ClientConnPool. This is a definite wart. I don't see a better way to do this other than exporting ClientConn.CloseIfIdle. |
Exposes CloseIfIdle and ClientConnPoolIdleCloser so connection pools can correctly close idle connections Fixes golang/go#17775
This comment has been minimized.
This comment has been minimized.
What is missing to merge this PR? |
This comment has been minimized.
This comment has been minimized.
@rs just a minor doc nit that @tombergan had suggested then a rebase and we can run the trybots and get some approvals. @bradfitz as you are back, please feel free to take a look at the CL https://go-review.googlesource.com/c/net/+/32326. |
The http2
Transport
exposes aCloseIdleConnections
method that will call the method of the same name on theClientConnPool
if it implements the privateclientConnPoolIdleCloser
interface. TheClientConnPool
implementation calls the private methodcloseIfIdle
on each pooledClientConn
.If one want to create a custom
ClientConnPool
, there is no way to make this custom pool support this feature without exposingCloseIfIdle
method andClientConnPoolIdleCloser
interface.