Skip to content

client idle connections leak FDs against Docker Desktop #45539

@tonistiigi

Description

@tonistiigi

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

23.0 but I assume all

docker info

23.0 but I assume all

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiAPIarea/cliClientkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/23.0

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions