Commit ec031cdf authored by Julien Muchembled's avatar Julien Muchembled

client: fix simultaneous (re)connections to the master

This fixes a reqression in commit c39d5c67,
which could leads to failures like:

2016-11-29 09:56:58,756 ERROR ZODB.Connection Couldn't load state for 0x4843
Traceback (most recent call last):
  File "ZODB/", line 860, in setstate
  File "ZODB/", line 901, in _setstate
    p, serial = self._storage.load(obj._p_oid, '')
  File "neo/client/", line 82, in load
  File "neo/client/", line 352, in load
    data, tid, next_tid, _ = self._loadFromStorage(oid, tid, before_tid)
  File "neo/client/", line 372, in _loadFromStorage
    for node, conn in self.cp.iterateForObject(oid, readable=True):
  File "neo/client/", line 91, in iterateForObject
    pt =
  File "neo/client/", line 146, in __getattr__
    return self.__getattribute__(attr)
AttributeError: 'Application' object has no attribute 'pt'
parent 15472c62
......@@ -138,11 +138,11 @@ class Application(ThreadedApplication):
def __getattr__(self, attr):
if attr in ('last_tid', 'pt'):
if self._connecting_to_master_node.locked():
if attr == 'last_tid':
# XXX: There's still a risk that we get disconnected from the
# master at this precise moment and for 'pt', we'd raise
# AttributeError. Should we catch it and loop until it
# succeeds?
return self.__getattribute__(attr)
def log(self):
......@@ -94,13 +94,14 @@ class PrimaryNotificationsHandler(MTEventHandler):
def answerLastTransaction(self, conn, ltid):
app =
if app.last_tid != ltid:
app_last_tid = app.__dict__.get('last_tid', '')
if app_last_tid != ltid:
# Either we're connecting or we already know the last tid
# via invalidations.
assert app.master_conn is None, app.master_conn
if app.last_tid < ltid:
if app_last_tid < ltid:
# In the past, we tried not to invalidate the
# Connection caches entirely, using the list of
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