mirror of
https://github.com/element-hq/synapse.git
synced 2026-05-14 06:05:10 +00:00
Improve We can't get valid state history. logging (#19765)
Add `event_id` so you can actually correlate everything together in the logs.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Improve Synapse logging around when someone encounters `We can't get valid state history.` so you can correlate everything by `event_id`.
|
||||
@@ -1166,9 +1166,10 @@ class FederationEventHandler:
|
||||
return await self._state_handler.compute_event_context(event)
|
||||
|
||||
logger.info(
|
||||
"Event %s is missing prev_events %s: calculating state for a "
|
||||
"backwards extremity",
|
||||
"_compute_event_context_with_maybe_missing_prevs(event_id=%s): Event in room %s is missing prev_events %s: "
|
||||
"calculating state for a backwards extremity",
|
||||
event_id,
|
||||
room_id,
|
||||
shortstr(missing_prevs),
|
||||
)
|
||||
# Calculate the state after each of the previous events, and
|
||||
@@ -1186,16 +1187,21 @@ class FederationEventHandler:
|
||||
|
||||
# Ask the remote server for the states we don't
|
||||
# know about
|
||||
for p in missing_prevs:
|
||||
logger.info("Requesting state after missing prev_event %s", p)
|
||||
for missing_prev in missing_prevs:
|
||||
logger.info(
|
||||
"_compute_event_context_with_maybe_missing_prevs(event_id=%s): Requesting state from %s for missing prev_event %s",
|
||||
event_id,
|
||||
dest,
|
||||
missing_prev,
|
||||
)
|
||||
|
||||
with nested_logging_context(p):
|
||||
with nested_logging_context(missing_prev):
|
||||
# note that if any of the missing prevs share missing state or
|
||||
# auth events, the requests to fetch those events are deduped
|
||||
# by the get_pdu_cache in federation_client.
|
||||
remote_state_map = (
|
||||
await self._get_state_ids_after_missing_prev_event(
|
||||
dest, room_id, p
|
||||
dest, room_id, missing_prev
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1225,7 +1231,11 @@ class FederationEventHandler:
|
||||
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
"Error attempting to resolve state at missing prev_events: %s", e
|
||||
"_compute_event_context_with_maybe_missing_prevs(event_id=%s): Error attempting to resolve state from "
|
||||
"%s for missing prev_events: %s",
|
||||
event_id,
|
||||
dest,
|
||||
e,
|
||||
)
|
||||
raise FederationError(
|
||||
"ERROR",
|
||||
|
||||
Reference in New Issue
Block a user