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

use [RLMResults count] in Realm notification listener crash #8553

Closed
chenyanping01 opened this issue Apr 22, 2024 · 5 comments
Closed

use [RLMResults count] in Realm notification listener crash #8553

chenyanping01 opened this issue Apr 22, 2024 · 5 comments
Assignees
Labels
Encryption:Off Frequency:Sometimes More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed

Comments

@chenyanping01
Copy link

How frequently does the bug occur?

Sometimes

Description

680918701

Stacktrace & log output

No response

Can you reproduce the bug?

-- select --

Reproduction Steps

No response

Version

10.49.1

What Atlas Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS 17.4.1

Build environment

Xcode version: ...
Dependency manager and version: ...

Copy link

sync-by-unito bot commented Apr 22, 2024

➤ PM Bot commented:

Jira ticket: RCOCOA-2337

@chenyanping01
Copy link
Author

chenyanping01 commented Apr 22, 2024

The code:

let messagesList = getRealm(for: Message.self).objects(Message.self).filter(predicate) //get messages from realm db
if notificationToken == nil {
      notificationToken = messagesList.observe(keyPaths: [\Message.isRead]) { [weak self] (changes: RealmCollectionChange) in
         switch changes {
         case .initial:
              print("[notificationToken] initial")
          case .update(let results, _, _, _):
              print("[notificationToken] update")
              let count = results.count // **_Crash here!!!_**
              updateUI(count)
                    
          case .error(let error):
              print("[notificationToken] error")
                
          }
      }
}
deinit {
        notificationToken?.invalidate()
        notificationToken = nil
 }

@nirinchev nirinchev self-assigned this Apr 22, 2024
@nirinchev
Copy link
Member

Do you think you can extract a minimal repro that we can use to investigate? There's nothing obviously wrong with your code or the calls mentioned in the stacktrace, so it's not clear what could be causing the crash. If we had a repro we could debug, that would go a long way to fixing it.

@sync-by-unito sync-by-unito bot added More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Apr 22, 2024
@Jaycyn
Copy link

Jaycyn commented Apr 22, 2024

Can you include the code for this getRealm(for: Message.self)?

Is this a local or sync'd realm

Are you using any kind of threading, await/async or @Actor?

Copy link

github-actions bot commented May 8, 2024

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@github-actions github-actions bot closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Encryption:Off Frequency:Sometimes More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. O-Community SDK-Use:Local T-Bug Waiting-For-Reporter Waiting for more information from the reporter before we can proceed
Projects
None yet
Development

No branches or pull requests

3 participants