From 660a3ebe465410a7a9113d9b851ea1915149a45e Mon Sep 17 00:00:00 2001 From: Hermes Date: Sat, 31 Oct 2026 09:40:33 +0100 Subject: [PATCH] tools.jitsi-matrix-relay: exit when the focus refuses the room After a switch restarted prosody and jicofo, the relay came back one second before jicofo, got service-unavailable on its conference IQ, and the uncaught IqError only ended the session_start handler: the process stayed connected but never joined the room. Disconnect instead, so it exits and systemd retries. --- tools/jitsi-matrix-relay/jitsi_matrix_relay.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/jitsi-matrix-relay/jitsi_matrix_relay.py b/tools/jitsi-matrix-relay/jitsi_matrix_relay.py index 2bb41582..eade9a6c 100644 --- a/tools/jitsi-matrix-relay/jitsi_matrix_relay.py +++ b/tools/jitsi-matrix-relay/jitsi_matrix_relay.py @@ -18,6 +18,7 @@ import aiohttp import slixmpp from aiohttp import web +from slixmpp.exceptions import IqError, IqTimeout from slixmpp.xmlstream import ET env = os.environ @@ -72,7 +73,14 @@ async def start(self, _): **{"machine-uid": uuid.uuid4().hex}, ) ) - await iq.send() + try: + await iq.send() + except (IqError, IqTimeout): + # e.g. jicofo not up yet after a restart: an exception here + # would only end this handler and leave us outside the room + logging.exception("focus did not set up the room") + self.disconnect() + return presence = self.make_presence(pto=f"{MUC}/{self.id}") x = ET.SubElement(presence.xml, f"{{{MUC_NS}}}x") ET.SubElement(x, f"{{{MUC_NS}}}history", maxstanzas="0")