Commit 44452395 authored by Julien Muchembled's avatar Julien Muchembled

client: fix an AssertionError while processing late AnswerRebaseObject

Traceback (most recent call last):
  ...
  File "neo/client/app.py", line 507, in tpc_vote
    self.waitStoreResponses(txn_context)
  File "neo/client/app.py", line 500, in waitStoreResponses
    _waitAnyTransactionMessage(txn_context)
  File "neo/client/app.py", line 150, in _waitAnyTransactionMessage
    self._handleConflicts(txn_context)
  File "neo/client/app.py", line 474, in _handleConflicts
    self._store(txn_context, oid, conflict_serial, data)
  File "neo/client/app.py", line 410, in _store
    self._waitAnyTransactionMessage(txn_context, False)
  File "neo/client/app.py", line 145, in _waitAnyTransactionMessage
    self._waitAnyMessage(queue, block=block)
  File "neo/client/app.py", line 133, in _waitAnyMessage
    _handlePacket(conn, packet, kw)
  File "neo/lib/threaded_app.py", line 133, in _handlePacket
    handler.dispatch(conn, packet, kw)
  File "neo/lib/handler.py", line 72, in dispatch
    method(conn, *args, **kw)
  File "neo/client/handlers/storage.py", line 122, in answerRebaseObject
    assert txn_context.conflict_dict[oid] == (serial, conflict)
AssertionError

Scenario:
0. unanswered rebase from S2
1. conflict resolved between t1 and t2 -> S1 & S2
2. S1 reports a new conflict
3. S2 answers to the rebase:
   returned serial (t1) is smaller than in conflict_dict (t2)
4. S2 reports the same conflict as in 2
parent 560e4fb1
......@@ -115,11 +115,9 @@ class StorageAnswersHandler(AnswerBaseHandler):
assert conn.uuid in txn_context.data_dict[oid][1]
return
assert oid in txn_context.data_dict
if oid in txn_context.conflict_dict:
# Another node already reported the conflict, by answering
# to this rebase or to the previous store.
# Filling conflict_dict again would be a no-op.
assert txn_context.conflict_dict[oid] == (serial, conflict)
if serial <= txn_context.conflict_dict.get(oid, ('',))[0]:
# Another node already reported this conflict or a newer,
# by answering to this rebase or to the previous store.
return
# A node has not answered yet to a previous store. Do not wait
# it to report the conflict because it may fail before.
......
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