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

A new room created by a new user sometimes contains duplicated timeline items #4758

Open
andybalaam opened this issue Mar 5, 2025 · 4 comments

Comments

@andybalaam
Copy link
Member

  • Existing user on Element X Android
  • In Element Web:
    • register a new user
    • create a DM with the existing user
    • send 2 messages
  • In Element X Android, accept the invitation. The timeline will be displayed.
  • Sometimes, there are duplicate items in the timeline:

Image

Note: this only happens sometimes. I estimate about 50% of the time.

(The same thing happens if you use Element X iOS instead of Element X Android.)

Image

I investigated this a bit and found that the duplicated items are provided via the initial_values from TimelineSubscriber, so they must be part of state.items within matrix_sdk_ui::timeline::controller::TimelineController::subscribe. I don't know why they appear, but I suspect we are updating the timeline in 2 different ways simultaneously, and some kind of race is happening.

(Found while testing https://github.com/element-hq/crypto-internal/issues/398 .)

@bnjbvr
Copy link
Member

bnjbvr commented Mar 6, 2025

Thanks, can you give us something actionable at the SDK level, since it's unclear this is a SDK bug, at this point: rageshake, Rust logs, or even better, a regression (integration) test?

@andybalaam
Copy link
Member Author

Here are the logs from my dev Android Studio.

Small-Phone-API-35-Android-15_2025-03-07_091140.txt

In the above log, I start a chat with one user test1027 and EXA shows the timeline correctly with no repeats, and then I start another with test1028 and I see duplicated items in the timeline.

I can't provide anything directly actionable: I don't know whether this is an SDK bug, but it seems likely since the behaviour is identical in EXA and EXI. Further, when I tried to track this in the debugger, I found that the initial_values from TimelineSubscriber contained the duplicated items, so it seems plausible that something is wrong in the SDK.

When I thought that my change had caused this problem, I wrote test_new_users_first_messages_dont_warn_about_insecure_device_if_it_is_secure in #4644 to try and reproduce it, but I didn't see this bug there. That test might be a good starting point.

@andybalaam
Copy link
Member Author

(Feel free to move this item somewhere else if it's more appropriate)

@andybalaam
Copy link
Member Author

A rageshake from my dev Android build is at https://github.com/element-hq/element-x-android-rageshakes/issues/4623

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

No branches or pull requests

2 participants