Skip to content

Pool close errors are not suppressed when ConnMaxIdleTime expired #3775

@camsteffen

Description

@camsteffen

When using ConnMaxIdleTime, when a pool connection is expired and then it fails to close, the error is suppressed here (if I understand correctly). I expect the error to be suppressed in the same manner when calling pool.Close(), but instead the error is returned. This makes it seem like something has gone wrong in a normal state where the server is expected to silently close idle connections (e.g. ElasticCache).

Expected Behavior

The Pool Close() method returns nil when connections fail to close where ConnMaxIdleTime is exceeded.

Current Behavior

Close() returns an error: tls: failed to send closeNotify alert (but connection was closed anyway): write tcp [redacted]: write: connection timed out

Possible Solution

If isHealthyConn is true, drop the error, similar to here.

Steps to Reproduce

  1. Connect to a server that drops idle connections after a timeout
  2. Configure a pool with ConnMaxIdleTime less than the server idle timeout
  3. Use the pool
  4. Wait for a connection to expire from the server
  5. Call pool.Close()

Context (Environment)

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions