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

Bug: Framework can cause app to crash due to variable data race with async access #159

Closed
benjaminmayo opened this issue Sep 15, 2023 · 1 comment · Fixed by #161
Closed
Labels
bug Something isn't working

Comments

@benjaminmayo
Copy link

benjaminmayo commented Sep 15, 2023

Describe the bug

The internal conversationsByTopic property can be accessed and mutated from various threads simultaneously due to concurrency. As access to this storage is not gated by a lock or other synchronization, this can lead to malformed memory and cause unavoidable crashes when the framework accesses that property.

See screenshot for an example of where Xcode caught the error in the debugger:
Screenshot 2023-09-15 at 23 44 57

Expected behavior

The XMTP framework should not induce crashes.

Steps to reproduce the bug

Client code that invokes Conversations methods which internally mutate the conversationsByTopic storage will eventually trigger the crash. This was first observed due to app code that observed streamAllMessages() and then also invoked the list() method.

@benjaminmayo benjaminmayo added the bug Something isn't working label Sep 15, 2023
@neekolas
Copy link
Contributor

Thanks for flagging this. Great catch!

nakajima added a commit that referenced this issue Sep 19, 2023
nakajima added a commit that referenced this issue Sep 19, 2023
* Make Conversations and Contacts actors.

Hopefully will fix #159.

* bump podspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants