robrix icon indicating copy to clipboard operation
robrix copied to clipboard

Handle tombstoned rooms properly to avoid adding the same room multiple times

Open kevinaboos opened this issue 1 year ago • 1 comments

Here's an example, in which the room "The Office of the Matrix Foundation" has been tombstoned and replaced with a new room, but they have the same room_id: "!CltYqaqkvHpbwjPFcs:matrix.org".

This causes the timeline_update_receiver created in add_new_room() to be replaced in ALL_ROOMS_INFO, which in turn causes the old one to be dropped. Then, when the original room instance attempts to send an update, the timeline_update_sender.send() call fails because the corresponding receiver has been dropped.

Below is the log output:

src/sliding_sync.rs:930:5 - Populating initial set of 0 known rooms.
src/home/rooms_list.rs:243:17 - RoomsList: processed 1 updates to the list of all rooms
2024-10-08T18:31:18.643267Z  INFO matrix_sdk::encryption::recovery: Recovery state changed from Unknown to Incomplete
2024-10-08T18:31:18.713080Z  WARN matrix_sdk_crypto::identities::manager: Our own device might have been deleted user_id="@kevinaboos:matrix.org" device_id="BVMLCDKGQG" curve25519_key="curve25519:r6vBTV0GY/lJFX0ue6baJBJC44V04+y2hP8OBlRwdV4" ed25519_key="ed25519:/KgR6H0N857EXycYD6WotNCkM6gUVjaf0qVGLkb/2CM"
src/sliding_sync.rs:963:46 - room_list: diff PushBack
src/sliding_sync.rs:1050:5 - Adding new room: "Empty Room", room_id: !CltYqaqkvHpbwjPFcs:matrix.org
2024-10-08T18:31:19.515965Z  INFO matrix_sdk_ui::room_list_service::room: No cached sliding sync room found for `!CltYqaqkvHpbwjPFcs:matrix.org`, the timeline will be empty.
src/sliding_sync.rs:1141:13 - Received an updated ignored-user list: []
src/sliding_sync.rs:1192:13 - Received a room list loading state update: Loaded { maximum_number_of_rooms: Some(29) }
src/home/rooms_list.rs:243:17 - RoomsList: processed 1 updates to the list of all rooms
2024-10-08T18:31:19.926715Z  WARN build{room_id="!CltYqaqkvHpbwjPFcs:matrix.org" track_read_receipts=true}: matrix_sdk_base::rooms::normal: Unknown room version, falling back to v10
2024-10-08T18:31:19.931166Z  INFO sending_task{room_id=!CltYqaqkvHpbwjPFcs:matrix.org}: matrix_sdk::send_queue: spawned the sending task
2024-10-08T18:31:19.931828Z  INFO local_echo_handler{room_id="!CltYqaqkvHpbwjPFcs:matrix.org"}: matrix_sdk_ui::timeline::builder: spawned the local echo handler!
src/sliding_sync.rs:1214:5 - Starting timeline subscriber for room !CltYqaqkvHpbwjPFcs:matrix.org...
src/sliding_sync.rs:1009:46 - room_list: diff Reset, new length 20
src/sliding_sync.rs:1050:5 - Adding new room: "Office of the Matrix.org Foundation", room_id: !CltYqaqkvHpbwjPFcs:matrix.org
src/sliding_sync.rs:1216:5 - Received initial timeline update of 2 items for room !CltYqaqkvHpbwjPFcs:matrix.org.
thread 'tokio-runtime-worker' panicked at src/sliding_sync.rs:1223:14:
Error: timeline update sender couldn't send update to room !CltYqaqkvHpbwjPFcs:matrix.org with initial items!

The key lines are:

src/sliding_sync.rs:1050:5 - Adding new room: "Empty Room", room_id: !CltYqaqkvHpbwjPFcs:matrix.org

and

src/sliding_sync.rs:1050:5 - Adding new room: "Office of the Matrix.org Foundation", room_id: !CltYqaqkvHpbwjPFcs:matrix.org

kevinaboos avatar Oct 08 '24 19:10 kevinaboos

This is currently blocked on Matrix SDK's issue, in which we cannot get a room's tombstoned state events. https://github.com/matrix-org/matrix-rust-sdk/pull/4211

kevinaboos avatar Nov 08 '24 18:11 kevinaboos

Blocked on #498

kevinaboos avatar Jun 11 '25 17:06 kevinaboos

This is now able to be worked on, as it has been fixed in Matrix and we do now observe tombstoned rooms as expected.

We should add a badge/icon to rooms that have been tombstoned (where the UnreadBadge usually is) to indicate that the room has been tombstoned and that the user needs to join the successor room.

kevinaboos avatar Jun 28 '25 00:06 kevinaboos

Solved by #536

kevinaboos avatar Sep 24 '25 18:09 kevinaboos