@@ -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