Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d66d68f

Browse files
authored
Add extra debug logging to federation sender (#12614)
... in order to debug some problems we've been having with certain events not being sent when expected.
1 parent c4514b9 commit d66d68f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

changelog.d/12614.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add extra debug logging to federation sender.

synapse/federation/sender/__init__.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,24 @@ async def _process_event_queue_loop(self) -> None:
343343
last_token, self._last_poked_id, limit=100
344344
)
345345

346-
logger.debug("Handling %s -> %s", last_token, next_token)
346+
logger.debug(
347+
"Handling %i -> %i: %i events to send (current id %i)",
348+
last_token,
349+
next_token,
350+
len(events),
351+
self._last_poked_id,
352+
)
347353

348354
if not events and next_token >= self._last_poked_id:
355+
logger.debug("All events processed")
349356
break
350357

351358
async def handle_event(event: EventBase) -> None:
352359
# Only send events for this server.
353360
send_on_behalf_of = event.internal_metadata.get_send_on_behalf_of()
354361
is_mine = self.is_mine_id(event.sender)
355362
if not is_mine and send_on_behalf_of is None:
363+
logger.debug("Not sending remote-origin event %s", event)
356364
return
357365

358366
# We also want to not send out-of-band membership events.
@@ -389,12 +397,16 @@ async def handle_event(event: EventBase) -> None:
389397
# above).
390398
#
391399
if event.internal_metadata.is_out_of_band_membership():
400+
logger.debug("Not sending OOB membership event %s", event)
392401
return
393402

394403
# Finally, there are some other events that we should not send out
395404
# until someone asks for them. They are explicitly flagged as such
396405
# with `proactively_send: False`.
397406
if not event.internal_metadata.should_proactively_send():
407+
logger.debug(
408+
"Not sending event with proactively_send=false: %s", event
409+
)
398410
return
399411

400412
destinations: Optional[Set[str]] = None
@@ -458,7 +470,10 @@ async def handle_event(event: EventBase) -> None:
458470
"federation_sender"
459471
).observe((now - ts) / 1000)
460472

461-
async def handle_room_events(events: Iterable[EventBase]) -> None:
473+
async def handle_room_events(events: List[EventBase]) -> None:
474+
logger.debug(
475+
"Handling %i events in room %s", len(events), events[0].room_id
476+
)
462477
with Measure(self.clock, "handle_room_events"):
463478
for event in events:
464479
await handle_event(event)
@@ -477,6 +492,7 @@ async def handle_room_events(events: Iterable[EventBase]) -> None:
477492
)
478493
)
479494

495+
logger.debug("Successfully handled up to %i", next_token)
480496
await self.store.update_federation_out_pos("events", next_token)
481497

482498
if events:

0 commit comments

Comments
 (0)