You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ConnectionPool's mark_dead() method is supposed to remove the dead connection from the connections list:
self.connections.remove(connection)
However the equality comparison implementation __eq__ in the Connection class is incorrect. It always returns True as long as both objects are Connection instances:
def __eq__(self, other):
if not isinstance(other, Connection):
raise TypeError(
"Unsupported equality check for %s and %s" % (self, other)
)
return True
This defect manifests itself by removing all good connections until the connections is empty. One dead connection will bring down the whole connection pool.
Proposed solution: removing __eq__ from Connection. Thoughts?
The text was updated successfully, but these errors were encountered:
I ended up modifying the __eq__ method on the Connection object to just use the __hash__ method for equality comparison. I think we also could have deleted the __eq__ method entirely; either way would work IMHO.
ConnectionPool
'smark_dead()
method is supposed to remove the deadconnection
from theconnections
list:self.connections.remove(connection)
However the equality comparison implementation
__eq__
in theConnection
class is incorrect. It always returnsTrue
as long as both objects areConnection
instances:This defect manifests itself by removing all good connections until the connections is empty. One dead connection will bring down the whole connection pool.
Proposed solution: removing
__eq__
fromConnection
. Thoughts?The text was updated successfully, but these errors were encountered: