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

user.Logout caused app crash due to `libc++abi: terminating due to uncaught exception of type std::logic_error: Cannot start a sync session for user '' because this user has been removed. #8342

Closed
fuermosi777 opened this issue Aug 27, 2023 · 2 comments

Comments

@fuermosi777
Copy link

fuermosi777 commented Aug 27, 2023

How frequently does the bug occur?

Always

Description

Followed in SwiftUI quick start guide but user.logout always crashes the app due to the error mentioned in the title.

Stacktrace & log output

libc++abi: terminating due to uncaught exception of type std::logic_error: Cannot start a sync session for user '64eacfbc24629d791762efd7' because this user has been removed.

Can you reproduce the bug?

Always

Reproduction Steps

  1. Created a app following SwiftUI quick start.
  2. Login anonymously
  3. Logout

In the ContentView, I have the following code:

if let user = realmApp.currentUser, user.state != .removed {
  let config = user.flexibleSyncConfiguration(...)
  RealmSyncView()
        .environment(\.realmConfiguration, config)
} else {
  LoginView()
}

The LoginView() didn't show up when user.logout() is tapped. The app crashes.

Version

v10.42.0

What Atlas Services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

iOS 16.4

Build environment

Xcode version: Version 14.3.1 (14E300c)
Dependency manager and version: ...

@fuermosi777
Copy link
Author

And the error is also not thrown in app.syncManager.errorHandler, not sure if this is intended.

@sync-by-unito sync-by-unito bot removed the T-Bug label Sep 12, 2023
@nirinchev
Copy link
Member

The error message could be improved, but you can't create a sync session for a logged-out user either. So the user.state check should instead look like user.state == .loggedIn.

@nirinchev nirinchev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 5, 2024
@sync-by-unito sync-by-unito bot closed this as completed Feb 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants