Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device list tracking is broken when using "full" syncs (using memory store) causing UTD's #4591

Open
toger5 opened this issue Dec 17, 2024 · 1 comment
Labels

Comments

@toger5
Copy link
Contributor

toger5 commented Dec 17, 2024

This Issue was transferred over from EC:
element-hq/element-call#2907

This is not anymore a specific EC issue because EC only used the memory store as a stop gap and now uses a IndexedDB based store.
This is still an issue in the js-sdk.

Original Description:

There seems to be a bit of a problem in the way we track other users' device lists.

matrix-sdk-crypto keeps a cache of other users' device lists, and relies on a notification in the device_lists section of the /sync response to let it know when a user has updated their devices (ie, that cache is stale). When we send an encrypted message to another user, we use that cache to know who to send it to.

That's ok as long as we keep doing incremental syncs. The problem is that Element Call, when it starts up, does a full /sync (ie, it doesn't pass a since parameter); in that case, the homeserver returns an empty device_lists response.

So, if another user has logged in on a new device while we were offline, we end up with a stale cache for that user's devices, and they will receive UTD messages from us.

This seems like something that needs to be fixed in matrix-js-sdk. Probably the easiest solution is to invalidate all device list caches on restart, if there is no saved sync token.

Note See also element-hq/element-call#2907 for more details.

@dosubot dosubot bot added the T-Defect label Dec 17, 2024
@poljar
Copy link
Contributor

poljar commented Dec 17, 2024

The native sliding sync implementation has a similar problem and we mark all tracked users as dirty when this happens. The relevant method for the OlmMachine can be found here: https://github.com/matrix-org/matrix-rust-sdk/blob/c8270cedb078155efdcbf3d78621c10c4fba3143/crates/matrix-sdk-crypto/src/machine/mod.rs#L2041-L2050.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants