Commit 17e5ac38 authored by Julien Muchembled's avatar Julien Muchembled

Close connection in case of AssertionError while processing a packet

This may help client to recover after an assertion failure.
For example, this should fix the following bug:

ERROR ZODB.Connection Couldn't load state for 0x13b6
Traceback (most recent call last):
  File "ZODB/Connection.py", line 851, 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 85, in load
    return self.app.load(oid)[:2]
  File "neo/client/app.py", line 435, in load
    result = self._loadFromStorage(oid, tid, before_tid)
  File "neo/client/app.py", line 450, in _loadFromStorage
    for node, conn in self.cp.iterateForObject(oid, readable=True):
  File "neo/client/pool.py", line 130, in iterateForObject
    conn = getConnForNode(node)
  File "neo/client/pool.py", line 155, in getConnForNode
    conn = self._initNodeConnection(node)
  File "neo/client/pool.py", line 61, in _initNodeConnection
    connector=app.connector_handler(), dispatcher=app.dispatcher)
  File "neo/lib/connection.py", line 749, in __init__
    super(MTClientConnection, self).__init__(*args, **kwargs)
  File "neo/lib/connection.py", line 685, in __init__
    node.setConnection(self)
  File "neo/lib/node.py", line 119, in setConnection
    attributeTracker.whoSet(self, '_connection')
AssertionError
parent 460ef1b0
......@@ -75,6 +75,9 @@ class EventHandler(object):
message = str(message)
conn.answer(Errors.ProtocolError(message))
conn.abort()
except AssertionError:
conn.close()
raise
def checkClusterName(self, name):
# raise an exception if the given name mismatch the current cluster name
......
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