Skip to content

Sliding sync: Clear the device list cache when the connection is reset. #3959

Closed
@erikjohnston

Description

@erikjohnston

There is a change in behaviour with device lists between the sliding sync proxy and simplified sliding sync. When the client "resets" the encryption sync loop (i.e. sends a request with no since token):

  • The proxy returns all device lists updates since the last request from the device that asked for device lists (this works similarly to to-device message handling).
  • Synapse returns no device lists updates, as it only returns changes since the provided token (which is null). This is in line with sync v2.

The effect of the above is that the rust sdk can easily miss device list updates that happen between the previous encryption sync request and sending an initial encryption sync request, when using SSS. Given the encryption loop "resets" relatively frequently (on one account it happened ~8 times in 12 hours), this will cause quite a few UTDs.

The Rust SDK should therefore ensure whenever the connection is reset the device list cache is cleared. To mitigate the performance impact of this change, the SDK may want to try and reduce the number of times it proactively resets the connection (I think this happens whenever a request fails).

The alternative would be to change how Synapse behaves to match the proxy. However, this would be quite a big undertaking with unknown costs (device list management is already incredibly expensive in Synapse, converting it to track what updates we have sent to each device would likely make it even worse).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions