matrix-org / matrix-org/matrix-ios-sdk
Racing conditions on MXStore (MXFileStore)
Nobody has claimed this yet.
- Dominant language
- Objective-C
- Stars
- 484
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
After some extensive debugging, I found that the paginate method is absolutely not thread safe. My chat app loads the rooms after login and starts the pagination for all rooms to fetch the latest (text/image/audio/video) messages. But doing so for all rooms at the same time causes racing conditions on the (file)store.
I've tried all sorts of things, with serial queues, dispatch groups, semaphores, no store, memory store, but nothing helps. The only thing that does work is to do the pagination on the main thread. But that would block the entire UI until all rooms finished paginating.
So my question here is two-fold:
- Would it be possible to pass a queue to the pagination method, so all operations will be performed on that queue
- The only reason I preload the messages is to display the latest message in the rooms list and to load the chat view faster. I can't use the latest summary event, because that could be a redact event.
To build a real chat app it would be very nice to:
- Be able to see the latest text/audio/image/video message in the room summary
- Be able to filter all the other events when paginating
Regards,
Victor.
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
The report names MXStore, MXFileStore, and the paginate method but no files or tests. Start by reproducing concurrent pagination across rooms with the file store, then trace the store access and pagination API. Done requires a defined thread-safe behavior and clear validation of the requested queue, message-summary, and event-filtering capabilities.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100