Description
When using the client (initialized via dockercli in my case) in a long-running process, the idle connections are not released. If you create multiple clients the FD count keeps growing indefinitely.
This can be demonstrated against Docker Desktop. I haven't tested other cases. I guess it also depends on the server's behavior and when the server will drop the connections.
A patch like tonistiigi@af6ada9 fixes the issue (as does setting DisableKeepAlives).
Other possible fixes could be:
- initialize transport from DefaultTransport (that has better defaults)
- Somehow wrap transport so all clients use the same keepalive pool
- Make this configurable. I would also need dockerCLI update then.
- Explore server side
- There is a call to
CloseIdleConns but that lifecycle is tricky to manage when initializing clients via dockerCLI based on multiple configs. Possibly defining a Finalizer could also result in the desired behavior.
Reproduce
Make calls with clients and monitor FD count. Alternatively, wrap the connection from the UNIX dialer and see that Close() is never called on the connection.
Expected behavior
No response
docker version
docker info
Additional Info
No response
Description
When using the client (initialized via
dockercliin my case) in a long-running process, the idle connections are not released. If you create multiple clients the FD count keeps growing indefinitely.This can be demonstrated against Docker Desktop. I haven't tested other cases. I guess it also depends on the server's behavior and when the server will drop the connections.
A patch like tonistiigi@af6ada9 fixes the issue (as does setting
DisableKeepAlives).Other possible fixes could be:
CloseIdleConnsbut that lifecycle is tricky to manage when initializing clients viadockerCLIbased on multiple configs. Possibly defining aFinalizercould also result in the desired behavior.Reproduce
Make calls with clients and monitor FD count. Alternatively, wrap the connection from the UNIX dialer and see that
Close()is never called on the connection.Expected behavior
No response
docker version
docker info
Additional Info
No response