matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Attempting to resync the device list for non existing user after federation turned off. #10218

Open brunakov opened 3 years ago

brunakov commented 3 years ago

Description

After disabling federation for my homeserver, I get logs related to device lists resync, for users that are no more in any rooms. Using nginx as reverse proxy, I have disabled federation by removing 8448 port from nginx conf file, set federation_domain_whitelist =[], and denied 8448 in ufw firewall. A log entry example would be:

2021-06-18 12:26:27,235 - synapse.handlers.device - 844 - DEBUG - _maybe_retry_device_resync-106 - Attempting to resync the device list for @philipp:netzgemeinde.eu
2021-06-18 12:26:27,235 - synapse.federation.federation_client - 175 - DEBUG - _maybe_retry_device_resync-106 - Invoked 'query_user_devices' with args: self=<synapse.federation.federation_client.FederationCl..., destination=netzgemeinde.eu, user_id=@philipp:netzgemeinde.eu, timeout=30000
2021-06-18 12:26:27,235 - synapse.federation.transport.client - 476 - DEBUG - _maybe_retry_device_resync-106 - Invoked 'query_user_devices' with args: self=<synapse.federation.transport.client.TransportLaye..., destination=netzgemeinde.eu, user_id=@philipp:netzgemeinde.eu, timeout=30000
2021-06-18 12:26:27,236 - synapse.handlers.device - 879 - INFO - _maybe_retry_device_resync-106 - 403: Federation denied with netzgemeinde.eu.

Looking at the database I find entries for this user in :

What tables have to be cleared for this user, so that synapse stops to resync the device list for those users ? Any APIs I can safely use?

Version information

brunakov commented 3 years ago

I found a single entry for each user synapse wants to resync their devices list, in device_lists_remote_resync table. Maybe I could delete the entries from there ?

erikjohnston commented 3 years ago

I found a single entry for each user synapse wants to resync their devices list, in device_lists_remote_resync table. Maybe I could delete the entries from there ?

Yup, that should work.

We should make sure that that happens automatically when we no longer share a room with the user. I think its just a case of adding a delete clause to mark_remote_user_device_list_as_unsubscribed function.

brunakov commented 3 years ago

By the way I deleted all entries on device_lists_remote_resync and the problem did not re-occur.