Skip to content

Destroy broken connection when it is put back to a pool #32

Closed
@Totktonada

Description

@Totktonada

The case: a connection is acquired from a pool, a request is made with this connection and fails, the connection is put back to the pool.

The connection is marked as broken in the case and will be discarded: a pool will not actually cache it, just count (<pool object>.queue:put(nil) under hood) that it may give (and create if needed) one more connection when it will be acquired. The math here looks correct. However an underlying raw connection of this 'broken' connection will not be closed neither when it put back to the pool, nor at GC (because the GC callback is removed at <pool object>:put() for both broken and healthy connections).

This behaviour looks as a bug. I propose to destroy the underlying connection when it is discarded at <pool object>:put(): i. e. close the underlying connection if it is broken.

We should test than the underlying connection is closed in the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions