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

Do not reuse room files if the room is marked for deletion #1390

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Mar 4, 2022

Fixes 5717, possibly related to element-hq/element-ios#5107, but could not reproduce the latter

When a user joins an invited room, the SDK will mark all previous room data for deletion, which includes a bunch of temporary events with fake IDs. It is sensible to delete this data, because it will be redownloaded from the server again.

... However.

The MXFileStore does not immediately delete the actual files, and another piece of code is already busy preparing room for the next events. Because the data hasn't yet been wiped away, the new room state is able to load it up into memory, and when the files are actually deleted, the MXFileStore already has another RoomState with those messages cached. At the next commit phase, it will save them back to the disk, incl the events that should have been deleted. A user facing result of this is some duplicate events, such as start of the room header.

To solve this the MXFileStore is not allowed to get an existing messages file if the roomID is marked for deletion in the next commit phase.

@Anderas Anderas merged commit 80fbef4 into develop Mar 8, 2022
@Anderas Anderas deleted the andy/5731_cached_messages branch March 8, 2022 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timeline displays multiple beginning headers
2 participants