-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Error when deleting RealmObject: Key not found #6992
Comments
➤ Brian Munkholm commented: [~finn.schiermer-andersen] Have you seen this before? |
No. |
@GaelCO How many is "a lot of users"? How big a % of users is it? |
It's most likely that you are trying to delete the same object twice. Perhaps check those places to guard against double deletion. |
About 30% of users encounter this issue. This users could have a lot elements to remove. `
|
And you are 100% sure removeDocument() is the only place you delete? |
Same as in #6994 |
I have a similar issue with more than 2000 crashes in my app :(
|
This occurred only after upgrading from 6.1.0 to 7.0.1. The crash itself happened after downloading a bunch of entities from a remote API and then using Realm’s insertOrUpdate(). |
Yes, I have a similar case. |
I am in a huge trouble with this issue :( The app is running for many users, but when they delete the app data then the next startup it crashes. Mostly the mentioned issue, but also sometimes this one #6995. The app uses Realm without big issues since 2016. Is it possible to downgrade to Realm 6? |
Are they deleting the app data when the app is running? Because in that case, I wouldn't be surprised there are weird crashes. But if you close the app, delete the app data and reopen the data I would expect things to work. I guess the big question is that how your code can get the above stacktrace if the Realm is empty? 🤔 In terms of downgrading, then you cannot downgrade an upgraded file, but if you delete the file, then it should be possible to downgrade. Not sure if that is an option for you? |
When I run the app it is working perfectly. The users are deleting the app data when the app is closed and I think the app crashes when syncing a lot of data in another thread at the launch time. As you already said, it will create a completely new default Realm file and this shouldn't be the problem. I will test the issue a bit more. Hm, I think downgrading would end up in more problems and it is just running away from the real issue... Thanks for your help :) |
@cmelchior What is the meaning of "Unrecoverable error. Key not found"? |
Each Object has a Key in the database. You get this error when you try to delete an Object that doesn't exist. But we can't rule out something fishy is going on, so a repro-case would be awesome and enable to either explain what you are doing wrong or determine there is indeed a bug. |
We are seeing a similar issue (we created #6994), but when trying to read an item from the Realm. We are also seeing this error when trying to insertOrUpdate a RealmMember, as well as an error that a key already exists when running insertOrUpdate on a RealmMember. We have not been able to reproduce ourselves but was effecting about 1% of our users over a wide range of devices before we downgraded realm back to 6.1.0, and this is now stopping us from upgrading until this issue can be fixed. |
Seems that I could find the issue. The app has executed around 2200 realm transactions. The transaction was similar like: realm.executeTransaction {
val managedMovie = realm.copyToRealmOrUpdate(movie)
realm.where(RealmMediaWrapper::class.java).findAll().forEach {
it.setContent(managedMovie)
}
} |
I still have not been able to reproduce by iterating a lot of creation/updates with cross-reference updates. Are there any patterns on the affected devices, e.g. 32/64bit, specific brands, etc.? |
Hi, I send a file with this behavior. This file contains fake data. |
Out of curiosity, I tried a "deleteAll". I have got an error too. It's not exactly the same (see the track).
|
I now have a good lead on this. |
Same bug here. Is the realm-core fix already affect a Java release ? If not, what/when will be this released out (Sorry I do not have deep knowledge of or release process) ? Thanks |
@afaucogney The fix hasn't been released yet on realm-java. It will be available in the next release. |
Any schedule for the next release ? At least an estimation would be nice. |
@GaelCO @ChrisBLN @afaucogney Sorry for not updating the issue. The fix is included from 10.1.0 from November 23th. Any feedback on the fix is most appreciated. |
Thanks @rorbech. I had no plan to just upgrade to 10 just because of the issue ? |
I can't find it in the changelog of 10.1.0, @rorbech, @clementetb. Has someone already updated to 10.1.x and noticed an improvement? |
@Jeff11 Sorry. The core fixes seems to have slipped from the change log. The fix (realm/realm-core#4051) was included by the upgrade to Core 10.1.3. |
Assume this has been solved |
That's not fixed the data corruption. With version 10.2.0, a crash occurs as soon as I touch the database. |
@GaelCO sorry to hear about this. When you say |
According to the Core team the original problem reported in this ticket should be fixed in realm/realm-core#4051 and was included in the latest Realm 10.1.3 release. However, once a Realm becomes corrupt, which could happen when upgrading from 6.x.x to 10.0.x (before the fix for the original "key not found" issue was released), it will continue to be so and, unfortunately, there is nothing we can do about it - see realm/realm-core#4051 (comment). With that in mind, it would be interesting to know if there are still instances of the original "key not found" crash after updating to version 10.1.3. |
It's when a run a query. (in my test project, add or delete items) |
It started to happen in a project that I am working when we updated realm gradle plugin from 5.9.0 to 7.0.0.
Is there any fix or workaround for the issue? |
@ptsiogas This issue should have been fixed in version 10.1.3, could you try to reproduce the issue on it? |
I take the liberty to close this issue again as the original problem on 32-bit devices has been solved. I anyone encounters new issues, please create new tickets for them. |
Goal
I have some weird errors on deleting object, but I don't understand why it's happened.
Unfortunately, I don't encountered this issue myself, but according to crashlytics data, lot of users have this bug.
Actual Results
Stack Trace by firebase Crashlytics :
Steps & Code to Reproduce
Version of Realm and tooling
Realm version(s): 7.0.0
Realm Sync feature enabled: No
Android Studio version: 4.0.0
Android Build Tools version: 29.0.3
Gradle version: 6.5
The text was updated successfully, but these errors were encountered: