-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fatal Exception: realm::KeyNotFound in Realm notification listener thread #7704
Comments
Hi @bodnar-dan Seems like the stack trace is not related to the crash, so we can't diagnose why this is happening. We may need more info to reproduce this. |
Thank you, I will update and return with a feedback. I will also try to find more info about the crash. |
I still see this in 10.25.0. |
@bodnar-dan Can I see a full stack trace for this crash, even though it seems like some realm related code is running in the main thread during the crash, the real crash is happening in the realm notification listener thread. |
@bodnar-dan Can you provide the requested information so that we can investigate further? |
@leemaguire sadly I don't have a stack trace of the crash. The crash is reported on the Firebase thread for a reason (I learned that this is a common issue). Maybe that's because often the crash is happening while the app is in background. Ofc, we're unable to reproduce it in any way. We only have this (and similar), without additional information. What I can also tell, is that for a specific user, it's always the same key and the same object. So, 805 is not random.
And I guess the We have 3 different Realms in our app (on different modules). All 3 Realm notification listener threads are looking normal.
All other threads are also not reporting any work. This issue is not affecting a lot of users, but it's repetitive for them (once happening, it always happens). |
found the same crash in Our project: where... it crashed on static Function |
Found this crash too..
|
We're running into this same exception/crash. We're using Realm 10.25.1. This happens rarely, but when it does happen, it is most often a case where we're in a write block trying to add/delete object A (object A contains a list property of object Bs), and the exception will be related to the primary key of object B.
|
@starchey the stack trace doesn't mention the error on this issue, can you please attach a more detailed stack trace. |
This is the full trace we're getting from Firebase. They all include Exception text like the following:
|
Sample code:
|
This issue may be caused by a file corruption that without access to a realm file it is really hard to diagnose. There is a fix which will be available in a future release which may fix this corruption issue realm/realm-core#5993 |
Thanks! Reading #8000 (comment), it sounds like this fix is included in v10.33.0, will update to that for our next release. |
We still have the issue using Realm v10.33.0, but those could be users that have had their files corrupted when using the previous version. @dianaafanador3 is there a way to catch file corruption exceptions so that we can handle them somehow, instead of crashing the app. Or is there any way for us to check the integrity of a Realm file? |
Actually for this particular case, if you catch the error |
@bodnar-dan can you update to our latest version 10.35.0, there are some fixes related to this in core, which may fix this issue. |
Hi, I'm using the latest release and i still get this error. |
Hi @andrefmsilva are you able to reproduce this. Can you please share a sample code with the reproduction you are describing? |
Hi @dianaafanador3, after some debug i found the problem for my case. I don't know if it's the same problem for other users but the error after corruption was the same. |
mmm interesting. Have you tried our Swift Type Safe Query API https://www.mongodb.com/docs/realm/sdk/swift/crud/filter-data/#std-label-ios-realm-swift-query-api, which may prevent this issues to happen in the future. |
I can't use the Query API with my current implementation because i have an abstraction layer that queries realm using some enum. Basically each enum has cases to query a specific schema and knows how to create the Predicate (or NSCompoundPredicate) and NSSortDescriptor |
@andrefmsilva The weird thing is that if you use our API for filtering using a predicate with a wrong property name, for example |
@bodnar-dan any updates from your side about this issue? |
Same issue with Realm version 10.38.0 - iPadOS 12.2.0 |
HI @huutrung789 can you provide any more information about your issue, stack trace, sample code so we can reproduce this?. |
We're closing this due to inactivity, but if you encounter a similar issue with the latest version of the Swift SDK, feel free to reopen. |
How frequently does the bug occur?
Sometimes
Description
Since version 10.22.0, but it happens in 10.24.0 too, we started to see this crash for some users. It happens in random places.
For example:
There's no stack trace for this crash.
The stracktrace below is what's happening on main queue, but like I said, it happens randomly... when we insert something or read something.
Stacktrace & log output
Can you reproduce the bug?
Not yet
Reproduction Steps
We wren't able to reproduce and few users are affected, but it happens repetitively for them.
Version
10.24.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 15.3.1
Build environment
Xcode version: Xcide 13.2.1
Dependency manager and version: Carthage
The text was updated successfully, but these errors were encountered: