matrix-org / matrix-org/matrix-rust-sdk

Sync and `get_members` can race in setting member events

Open
#1,205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

In https://github.com/matrix-org/matrix-rust-sdk/pull/1134 we removed the check to only set members events if they didn't exist before. get_members now sets all the the member events from the response.

If we sync at the same time, it might happen that both sync and get_members write to the member events at the same time and race, possibly overwriting up to date information with less up to date ones?

Quote on how to fix this by @poljar :

One idea is that there should be a way to know which users are currently being added via the sync so that we can skip them, I think Hydrogen does something along those lines.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by reviewing PR 1134 and tracing the sync and get_members paths where member events are written concurrently. Done means concurrent operations cannot overwrite newer member information with older data; add focused coverage for that race.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.