• Julien Muchembled's avatar
    Give new ids to clients whose ids were already reallocated · d752aadb
    Julien Muchembled authored
    Although the change applies to any node with a temporary ids (all but storage),
    only clients don't have addresses and are therefore not recognizable.
    
    After a client is disconnected from the master and before reconnecting, another
    client may join the cluster and "steals" the id of the first client. This issue
    leads to stuck clients, failing in loop with exceptions like the following one:
    
        ERROR ZODB.Connection Couldn't load state for 0x0251
        Traceback (most recent call last):
          File "ZODB/Connection.py", line 860, in setstate
            self._setstate(obj)
          File "ZODB/Connection.py", line 901, in _setstate
            p, serial = self._storage.load(obj._p_oid, '')
          File "neo/client/Storage.py", line 82, in load
            return self.app.load(oid)[:2]
          File "neo/client/app.py", line 353, in load
            data, tid, next_tid, _ = self._loadFromStorage(oid, tid, before_tid)
          File "neo/client/app.py", line 373, in _loadFromStorage
            for node, conn in self.cp.iterateForObject(oid, readable=True):
          File "neo/client/pool.py", line 91, in iterateForObject
            pt = self.app.pt
          File "neo/client/app.py", line 145, in __getattr__
            self._getMasterConnection()
          File "neo/client/app.py", line 214, in _getMasterConnection
            result = self.master_conn = self._connectToPrimaryNode()
          File "neo/client/app.py", line 246, in _connectToPrimaryNode
            handler=handler)
          File "neo/lib/threaded_app.py", line 154, in _ask
            _handlePacket(qconn, qpacket, kw, handler)
          File "neo/lib/threaded_app.py", line 135, in _handlePacket
            handler.dispatch(conn, packet, kw)
          File "neo/lib/handler.py", line 66, in dispatch
            method(conn, *args, **kw)
          File "neo/lib/handler.py", line 188, in error
            getattr(self, Errors[code])(conn, message)
          File "neo/client/handlers/__init__.py", line 23, in protocolError
            raise StorageError("protocol error: %s" % message)
        StorageError: protocol error: already connected
    d752aadb
test.py 51.4 KB