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

Commit d64e851

Browse files
authored
Remove error spam when users query the keys of departed remote users (#13826)
The error message introduced in #13749 has turned out to be very spammy. Remove it for now.
1 parent 384dca5 commit d64e851

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

changelog.d/13826.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long standing bug where device lists would remain cached when remote users left and rejoined the last room shared with the local homeserver.

synapse/handlers/e2e_keys.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,21 @@ async def query_devices(
188188
)
189189
invalid_cached_users = cached_users - valid_cached_users
190190
if invalid_cached_users:
191-
# Fix up results. If we get here, there is either a bug in device
192-
# list tracking, or we hit the race mentioned above.
191+
# Fix up results. If we get here, it means there was either a bug in
192+
# device list tracking, or we hit the race mentioned above.
193+
# TODO: In practice, this path is hit fairly often in existing
194+
# deployments when clients query the keys of departed remote
195+
# users. A background update to mark the appropriate device
196+
# lists as unsubscribed is needed.
197+
# https://github.com/matrix-org/synapse/issues/13651
198+
# Note that this currently introduces a failure mode when clients
199+
# are trying to decrypt old messages from a remote user whose
200+
# homeserver is no longer available. We may want to consider falling
201+
# back to the cached data when we fail to retrieve a device list
202+
# over federation for such remote users.
193203
user_ids_not_in_cache.update(invalid_cached_users)
194204
for invalid_user_id in invalid_cached_users:
195205
remote_results.pop(invalid_user_id)
196-
# This log message may be removed if it turns out it's almost
197-
# entirely triggered by races.
198-
logger.error(
199-
"Devices for %s were cached, but the server no longer shares "
200-
"any rooms with them. The cached device lists are stale.",
201-
invalid_cached_users,
202-
)
203206

204207
for user_id, devices in remote_results.items():
205208
user_devices = results.setdefault(user_id, {})

0 commit comments

Comments
 (0)