Skip to content
This repository was archived by the owner on Sep 24, 2022. It is now read-only.
This repository was archived by the owner on Sep 24, 2022. It is now read-only.

self.conns.empty() in Pool.close will not work as expected by big chance #141

Description

@masknu

When there are busy connections at the time you invoking Pool.close(), after close_alive() being called, those busy connections will be put back to self.dead of ConnectionContainer at next io_loop iteration if connections are managed by Pool.manage(). Thus, the empty() call next to close_alive() would be meaningless, and it will fire the assert by wrong reason:assert conn in self.busy, "Tried to release non-busy connection"

def close(self):
    if self.closed:
        raise PoolError('connection pool is already closed')

    self.conns.close_alive()
    #following line would be meaningless if there are busy connections out there
    self.conns.empty()
    self.closed = True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions