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

Multiplexing seems to periodically crash the SyncClient during Client Reset #6656

Closed
cmelchior opened this issue May 22, 2023 · 2 comments · Fixed by #6676
Closed

Multiplexing seems to periodically crash the SyncClient during Client Reset #6656

cmelchior opened this issue May 22, 2023 · 2 comments · Fixed by #6676
Assignees

Comments

@cmelchior
Copy link
Contributor

Reported internally on Slack here: https://mongodb.slack.com/archives/CUSNYAJ4R/p1684334160942949

Seen by JS, Kotlin and Swift.

This is a CI run on Kotlin hitting this: https://ci.realm.io/blue/organizations/jenkins/realm%2Frealm-kotlin/detail/main/120/pipeline

So far, it has not been possible to reproduce it locally.

# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x000000012aad380b, pid=79762, tid=129599
# Problematic frame:
# C  [librealmc.dylib+0x2a080b]  _ZN5realm4sync10ClientImpl7Session15call_debug_hookERKNS_18SyncClientHookDataE+0x8b

So far the theory is that this is connected to multiplexing which was just recently enabled.

Multiplexing can be disabled again using realm_sync_client_config_set_multiplex_sessions() in the C-API. We need more testing to figure out if this is enough to work around the problem until a proper fix can be found.

@sync-by-unito
Copy link

sync-by-unito bot commented May 22, 2023

➤ michael-wb commented:

Here is the conversation for the failure seen with the JS SDK: https://mongodb.slack.com/archives/CUSNYAJ4R/p1684334160942949

This was seen when a JSON error was received from the server, resulting in the crash.

@sync-by-unito
Copy link

sync-by-unito bot commented May 23, 2023

➤ michael-wb commented:

The SessionWrapper has a pointer to the ClientImpl::Session and the Connection holds the unique_ptr for the Session. In addition, the Session has references to its SessionWrapper and Connection.
There is a tiny window when the session is being torn down where the SessionWrapper has been destroyed, but the Session instance is still around since the BIND message has not been sent yet.
For this crash, the Session is in the process of being torn down when a message is received from the connection that causes the Session to call functions on the SessionWrapper instance, which now points to an object that has been destroyed.

Investigating the best way to handle the different lifetimes...

nielsenko added a commit to realm/realm-dart that referenced this issue May 24, 2023
nielsenko added a commit to realm/realm-dart that referenced this issue May 24, 2023
nielsenko added a commit to realm/realm-dart that referenced this issue May 24, 2023
nielsenko added a commit to realm/realm-dart that referenced this issue May 25, 2023
* Update realm-core to v13.12.0

* Ran ffigen to update realm_bindings.dart

* Fix realm_core.dart after upgrade

* Disable multiplexing for now, due to: realm/realm-core#6656

* Update CHANGELOG

* Fix mistake in CHANGELOG.md

* Tweak logger tests to match trace level of v13.12.0

* Remove links to realm-core PRs/issues from CHANGELOG.md
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 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.

2 participants