Skip to content

KeyError on self._in_use_connections.remove(connection) #1138

@jkamashian

Description

@jkamashian

Version: 2.10.5
Platform: Python 2.7, Ubuntu
This is a very rare occurrence on a very high traffic server but I receive a key error occasionally from here:
self._in_use_connections.remove(connection)
https://github.com/andymccurdy/redis-py/blob/2.10.5/redis/connection.py#L913
I haven't been able to reproduce this in testing or root out the cause.

Theories:
self._available_connections is a list so you could append in the same connection more then once. Then when you try to self._in_use_connections.add(connection)
https://github.com/andymccurdy/redis-py/blob/2.10.5/redis/connection.py#L898
You get no error for using the same connection. Until you try to release _in_use_connections is a set so were the add() multiple times desen't raise an error remove() will.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions