matrix-org / matrix-org/matrix-rust-sdk
A new room created by a new user sometimes contains duplicated timeline items
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
* 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:

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.)

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 .)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with a new Element Web user and an existing Element X Android or iOS user, then inspect matrix_sdk_ui::timeline::controller::TimelineController::subscribe and the TimelineSubscriber initial_values path. Trace how state.items is populated during room creation and accepting the invitation; done means the initial timeline contains no duplicated items.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100