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

SyncSession.resume/pause crash after receiving remote update #1068

Closed
cmelchior opened this issue Oct 13, 2022 · 1 comment · Fixed by #1071
Closed

SyncSession.resume/pause crash after receiving remote update #1068

cmelchior opened this issue Oct 13, 2022 · 1 comment · Fixed by #1071
Assignees

Comments

@cmelchior
Copy link
Contributor

cmelchior commented Oct 13, 2022

It looks like the SyncSessionImpl.nativePointer is somehow being outdated and crashes the app when being used (e.g. when calling pause/resume).

This is reproducible by having two apps communicating. After Device A sends changes to Device B, Device B will crash when interacting with the SyncSession pointer.

@cmelchior cmelchior self-assigned this Oct 13, 2022
@cmelchior cmelchior changed the title SyncSession.resume/pause crash after updates SyncSession.resume/pause crash after receiving remote update Oct 13, 2022
@cmelchior
Copy link
Contributor Author

The root problem was due to a pointer going out of date. The sequence was as follows:

  1. Device A: Open Flexible Sync with initialSubscriptions. This would trigger the creation of the SyncedContext which stored a copy of the current dbPointer.
  2. Device B writes a change
  3. Device A receives this change, integrates it, updates the Realm pointer and closes the old one
  4. Device A access the SyncSession. This tried to lazily create the session pointer using the, now closed, dbPointer.
  5. Device A would crash with a SEGFAULT.

Creating both Subscriptions and SyncSession immediately when accessed the first time fixes the problem.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant