• Julien Muchembled's avatar
    client: fix AssertionError when trying to reconnect too quickly after an error · 305dda86
    Julien Muchembled authored
    When ConnectionPool._initNodeConnection fails a first time with:
    
      StorageError: protocol error: already connected
    
    the following assertion failure happens when trying to reconnect before the
    previous connection is actually closed (currently, only the node sending an
    error message closes the connection, as commented in EventHandler):
    
      Traceback (most recent call last):
        File "neo/client/Storage.py", line 82, in load
          return self.app.load(oid)[:2]
        File "neo/client/app.py", line 367, in load
          data, tid, next_tid, _ = self._loadFromStorage(oid, tid, before_tid)
        File "neo/client/app.py", line 399, in _loadFromStorage
          askStorage)
        File "neo/client/app.py", line 293, in _askStorageForRead
          conn = cp.getConnForNode(node)
        File "neo/client/pool.py", line 98, in getConnForNode
          conn = self._initNodeConnection(node)
        File "neo/client/pool.py", line 48, in _initNodeConnection
          dispatcher=app.dispatcher)
        File "neo/lib/connection.py", line 704, in __init__
          super(MTClientConnection, self).__init__(*args, **kwargs)
        File "neo/lib/connection.py", line 602, in __init__
          node.setConnection(self)
        File "neo/lib/node.py", line 122, in setConnection
          attributeTracker.whoSet(self, '_connection'))
      AssertionError
    305dda86
test.py 109 KB