A witness that misses an event is never receipted: no retry, and resubmit never collects the receipt
Versions: KERIA 0.3.0 (gleif/keria:0.3.0) with Signify-TS 0.3.0-rc2, and KERIA 0.4.0 (weboftrust/keria:0.4.0) with Signify-TS 0.4.0. Witnesses: gleif/keri:1.2.9 (KERIpy 1.3.1). The Submitter code on main looks the same.
Reproduction: https://gist.github.com/Essbante/c5403b0968e7ddc8925e252c87416ec0 (Docker Compose with KERIA and three witnesses, and one script; npm install, docker compose up -d --wait, npm run repro).
What happens
- Create an AID with 3 witnesses and a witness threshold of 3 while
witness-3is stopped. - Start
witness-3again. The inception never completes: KERIA does not send the event towitness-3again (checked for 30 seconds; it stays like this). - Call the resubmit endpoint,
POST /identifiers/{name}/submitwith a non-nullsubmit.witness-3receives the event, but neither the resubmit operation nor the original operation completes (checked for 60 seconds; in earlier runs, 120 seconds).
The same happens for a rotation, and the same on KERIA 0.3.0 and 0.4.0.
Expected: the witness is sent the event when it is back, or at least after a resubmit, and the operation completes once the witness threshold is met.
Cause, as far as we can see
keria/app/agenting.py,Witnesser, uses KERIpy'sagenting.Receiptor.receipt, which sends each event once per witness. A witness it cannot reach is logged and skipped; nothing retries it.keria/app/agenting.py,Submitter, uses KERIpy'sWitnessReceiptor(force=True)withHTTPMessenger.HTTPMessengerposts the event but never reads the witness's reply, so the receipt is never stored in KERIA. All resubmits share oneWitnessReceiptor.- Unrelated, in the same
Submitter:hasattr(msg, "code")is used on a dict, so witness authentication codes are never sent.
A second problem in the same path (KERIA 0.3.0)
A resubmit sent while a witness of the event cannot be reached stops the whole KERIA process. Submitter.recur raises socket.gaierror, and nothing catches it (CRASH_ONLY=1 npm run repro in the reproduction):
File "/keria/src/keria/app/agenting.py", line 1568, in recur
return super(Submitter, self).recur(tyme, deeds)
...
File ".../keri/app/agenting.py", line 339, in receiptDo
witer = messenger(hab, wit, auth=auth)
File ".../keri/app/agenting.py", line 1029, in messengerFrom
witer = HTTPMessenger(hab=hab, wit=pre, url=url, auth=auth)
File ".../keri/app/agenting.py", line 871, in __init__
self.client = http.clienting.Client(scheme=up.scheme, hostname=up.hostname, port=up.port)
...
socket.gaierror: [Errno -5] Name has no usable address
This looks like the same kind of crash as #125, in a different place.
Workaround we use
After the resubmit, fetch each witness's receipt with GET {witness}/receipts?pre={AID}&sn={sn} and post it to KERIA's KERI HTTP endpoint (path /, headers CESR-DESTINATION: {AID} and CESR-ATTACHMENT: {attachments}, body the receipt's JSON). The operation then completes within seconds. For a rotation, the receipts of all witnesses are needed. We resubmit only once every witness of the event answers, because of the crash above.
Related: #235 asked for a way to resubmit a KEL to its witnesses, which #271 added as /identifiers/{name}/submit.
I reproduced a related case with KERIA 0.4.1 (KERIpy 1.2.14): after adding a witness during rotation, its accepted KEL remained at inception and the operation was still pending after 180 seconds.
I traced this to Receiptor.catchup(): after the first response, it queues the remaining KEL events without yielding, then removes the HTTP client. Consuming each response in a temporary test copy let the rotation complete in about 1.1 seconds. Details: WebOfTrust/keripy#1745.
This does not cover the offline-witness and resubmit cases described above.