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

Deleting stale devices causes lots of device updates to be sent out over federation #14651

Open
anoadragon453 opened this issue Dec 9, 2022 · 1 comment
Labels
A-Device-List-Tracking Telling clients about other devices. Often related to E2EE. A-Federation S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@anoadragon453
Copy link
Member

anoadragon453 commented Dec 9, 2022

#14595 introduced a background job code that runs in DeviceWorkerHandler.check_device_registered to remove old, non-e2ee devices for users that had >50 devices, in an attempt to reduce the number of devices on homeservers.

When this was applied to matrix.org, it ended up spamming homeservers over federation with device list updates.

We may want to consider a rate-limit for the amount of devices we remove in this - and future - cleanup jobs.

@anoadragon453 anoadragon453 added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Dec 9, 2022
@anoadragon453
Copy link
Member Author

anoadragon453 commented Dec 9, 2022

Was it expected that this code should run when a user uploads e2ee keys?

# the device should have been registered already, but it may have been
# deleted due to a race with a DELETE request. Or we may be using an
# old access_token without an associated device_id. Either way, we
# need to double-check the device is registered to avoid ending up with
# keys without a corresponding device.
await self.device_handler.check_device_registered(user_id, device_id)

If not, it may be causing much more frequent device pruning than expected. We may want to prevent the stale device purge code from running in this case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Device-List-Tracking Telling clients about other devices. Often related to E2EE. A-Federation S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants