Commit bf6569d6 authored by Julien Muchembled's avatar Julien Muchembled

client: fix race condition when a storage connection is closed just after identification

The consequence was that the client never reconnected to that storage node.
On commits, writes to that node always failed, causing the master to
disconnect it.
parent 21a61977
...@@ -98,7 +98,13 @@ class ConnectionPool(object): ...@@ -98,7 +98,13 @@ class ConnectionPool(object):
conn = self._initNodeConnection(node) conn = self._initNodeConnection(node)
if conn is not None: if conn is not None:
self.connection_dict[uuid] = conn self.connection_dict[uuid] = conn
if not conn.isClosed():
return conn return conn
# conn was closed just after the reception of
# AnswerRequestIdentification (e.g. RST upon ACK),
# and removeConnection may have been called (by the
# poll thread) before we add it to connection_dict.
self.connection_dict.pop(uuid, None)
def removeConnection(self, node): def removeConnection(self, node):
self.connection_dict.pop(node.getUUID(), None) self.connection_dict.pop(node.getUUID(), None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment