mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-09 13:22:01 +00:00
Add fields to better debug where events are being soft_failed (#10168)
Follow-up to https://github.com/matrix-org/synapse/pull/10156#discussion_r650292223
This commit is contained in:
parent
52c60bd0a9
commit
a911dd768b
1
changelog.d/10168.misc
Normal file
1
changelog.d/10168.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add extra logging fields to better debug where events are being soft failed.
|
@ -2423,7 +2423,11 @@ class FederationHandler(BaseHandler):
|
|||||||
)
|
)
|
||||||
|
|
||||||
async def _check_for_soft_fail(
|
async def _check_for_soft_fail(
|
||||||
self, event: EventBase, state: Optional[Iterable[EventBase]], backfilled: bool
|
self,
|
||||||
|
event: EventBase,
|
||||||
|
state: Optional[Iterable[EventBase]],
|
||||||
|
backfilled: bool,
|
||||||
|
origin: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Checks if we should soft fail the event; if so, marks the event as
|
"""Checks if we should soft fail the event; if so, marks the event as
|
||||||
such.
|
such.
|
||||||
@ -2432,6 +2436,7 @@ class FederationHandler(BaseHandler):
|
|||||||
event
|
event
|
||||||
state: The state at the event if we don't have all the event's prev events
|
state: The state at the event if we don't have all the event's prev events
|
||||||
backfilled: Whether the event is from backfill
|
backfilled: Whether the event is from backfill
|
||||||
|
origin: The host the event originates from.
|
||||||
"""
|
"""
|
||||||
# For new (non-backfilled and non-outlier) events we check if the event
|
# For new (non-backfilled and non-outlier) events we check if the event
|
||||||
# passes auth based on the current state. If it doesn't then we
|
# passes auth based on the current state. If it doesn't then we
|
||||||
@ -2501,7 +2506,17 @@ class FederationHandler(BaseHandler):
|
|||||||
try:
|
try:
|
||||||
event_auth.check(room_version_obj, event, auth_events=current_auth_events)
|
event_auth.check(room_version_obj, event, auth_events=current_auth_events)
|
||||||
except AuthError as e:
|
except AuthError as e:
|
||||||
logger.warning("Soft-failing %r because %s", event, e)
|
logger.warning(
|
||||||
|
"Soft-failing %r (from %s) because %s",
|
||||||
|
event,
|
||||||
|
e,
|
||||||
|
origin,
|
||||||
|
extra={
|
||||||
|
"room_id": event.room_id,
|
||||||
|
"mxid": event.sender,
|
||||||
|
"hs": origin,
|
||||||
|
},
|
||||||
|
)
|
||||||
soft_failed_event_counter.inc()
|
soft_failed_event_counter.inc()
|
||||||
event.internal_metadata.soft_failed = True
|
event.internal_metadata.soft_failed = True
|
||||||
|
|
||||||
@ -2614,7 +2629,7 @@ class FederationHandler(BaseHandler):
|
|||||||
context.rejected = RejectedReason.AUTH_ERROR
|
context.rejected = RejectedReason.AUTH_ERROR
|
||||||
|
|
||||||
if not context.rejected:
|
if not context.rejected:
|
||||||
await self._check_for_soft_fail(event, state, backfilled)
|
await self._check_for_soft_fail(event, state, backfilled, origin=origin)
|
||||||
|
|
||||||
if event.type == EventTypes.GuestAccess and not context.rejected:
|
if event.type == EventTypes.GuestAccess and not context.rejected:
|
||||||
await self.maybe_kick_guest_users(event)
|
await self.maybe_kick_guest_users(event)
|
||||||
|
Loading…
Reference in New Issue
Block a user