-
Notifications
You must be signed in to change notification settings - Fork 163
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
Bad Realm file header (#3) #2258
Comments
This refers to a situation where the top-ref points to a top-array lying beyond the logical end of the file. |
Could be the same root cause as realm/realm-java#3264 / tracked as Core issue #2230 |
@beeender Any chance of a) different paths are being used by different threads, but for the same database (aliasing) ? or b) this involves sharing among multiple processes? |
I checked a few of the problematic devices reporting crashes from realm/realm-java#3264 and they are using 32-bit CPUs. This information, in addition to the note by @finnschiermer that
leads me to believe that the problem is the same one that @danielpovlsen is tracking down where the allocator somehow generates memory addresses which are too high on 32 bit devices (Daniel can reproduce this on the iPhone 5, 32-bit iOS simulator but I cannot). @danielpovlsen do you have an issue with more information on this? |
This could point to a problem with managing the shared memory mappings, then. |
This issue is linked to #2984. Here is the crash log http://crashes.to/s/706cc3e62fc. |
This is the only bug left even after updating to 2.2.1. Almost 16-17 crashes every day. Please fix this. |
We need a repro to make progress. |
@finnschiermer could we in the mean time add more logging info to get further clues? |
@mihirjoshi21 are you using encrypted Realm files? |
@ironage No realm file is not encrypted. |
Any update on this? |
@mihirjoshi21 Do you have a reproduction case for this? |
@teotwaki Only if I could reproduce it but I can't. There is no pattern in the crash and not specific to any android version or device types. This is the crash log http://crashes.to/s/706cc3e62fc. |
We have more and more user reporting this issue. @finnschiermer @ironage I got some information from user which can be found in realm/realm-java#5063 But the information we got doesn't seem to be helpful to identify the issue. Please, if you have something in mind, just ask @AlexTip who reported it to get more information. |
Hi there. I'll provide all the information I can on demand. |
I guess the question is whether bug occurs from core or object store. |
@AlexTip @finnschiermer @ironage please correct me if i am wrong. |
I'm sorry, but we need to be able to reproduce this before we can make further progress. |
@paulVulog @ptsiogas It's worth noting that this is not a "specific bug", but an indication that your realm got corrupted. That could be for entirely different reasons. So it's super valuable to get as much info as you can provide about your specific circumstances. |
@bmunkholm In production it occurs at 0.4% of the users. The 91% occurs in devices with Android 4 and 86% are Samsung. They all seem to have enough free space in their devices but most of them have less than 20% of the RAM available. |
@harryoik In the scenario you describe above, where less than 20% of RAM is available, what is the size of your realm file relative to the RAM size on those devices? Also, what is the absolute size of your realm file? |
@harryoik Thanks for those details! Once the realm file is corrupted, it will always repeat the same error when the app is restarted. The realm file has to be replaced in order to recover. So when you say it's repeatable, do you mean the error is repeated when the app is restarted? If you have a case where you can reproduce the situation where the app is fine, but doing something corrupts the file so that when the app is restarted you get the error - then we are super interested to learn how we can reproduce that. |
@finnschiermer I don't know the exact size of the realm file in those devices but it will be about 4-5MBs so it's pretty small. |
Do you have a work around at application start to:
|
Unfortunately not. But we just discussed to create a proposal for that: See #3031 |
So this bug is consistent since beta days of realm. Now the app has over 400k users and it occurs for less than 1 percent of the people so it's pretty rare. There is no pattern like certain devices, low memory or android version. In almost 2 years I have never been able to reproduce it. Some bugs you just live up with. |
Which version do you use? |
@bmunkholm 5.0.0 |
The same crash has happened 28k times (425 different users) for the app I'm working on as well. We're now on 5.0.0 but doesn't seem to make a difference. Also seems to happen on many devices and OS's. The only thing I did notice in Fabric's dashboard view is that 89% of the time this happened the app was running in the background.
|
@jpageo4500 Wauu that's a lot... Sorry to hear that. Once you have a corrupt file it will keep crashing no matter how many times you restart the app. One crude way to handle this is to catch the exception and delete the Realm and restart the app. In the meantime, we should consider an update with more information about how the file is corrupted to see if there is anything we can learn from that. @finnschiermer @jedelbo other ideas? |
Still having the issue here too. It has a pretty huge impact on user experience since as explained, as soon as the realm file is corrupted, you get a crash every-time you call : Realm.getDefaultInstance() The only hack for now is :
Here is my sample code at application initialization time :
Less than 1% of crash is still a lot ! A fix needs to be created.
On my side I have no other specific information regarding this crash. |
thanks @paulVulog - I was wondering if I could recover from this Exception and the example you're using above seems like a good idea. Certainly better than letting the app crash (more so if the user will never be able to restart it again w/out clearing the app cache/data) I'm still interested in finding out what might have caused this corrupted file in the first place and will keep searching. I'll also log a non-fatal Exception to Fabric to help narrow the search down. Is there anything useful I can add to my logging at the time this happens? I was a little interested to see that Fabric reported most of the crashes took place while the app was in the background.. I wonder if Android is killing some long-running background process that's taking too long which is creating this situation in the first place |
Thanks @paulVulog for sharing this. The header contains a cookie to detect that this is indeed a realm file. It's never supposed to be overwritten, and trying to repair the file is not the right solution as a lot of other stuff could be wrong. |
Sorry, I forgot to say that @jpage4500 : In my case, I have no crash reported until the application initialization (i.e : application restart). Thanks for the explanation @bmunkholm . If the header is never overwritten, is it possible that the "header reader" return a false error while checking if it is a realm file ? |
That seems highly unlikely. But I suggest we log what in the header is considered wrong, and possibly the whole header so we can see if it's been completely overwritten in some way. (Tracking here: #3075) |
If you get a |
These kinds of errors are now tracked in #3133. Closed as a duplicate. |
One of realm-java user gets crashes with below backtrace
It happens to Android
6.0
,4.4.4
,5.0.2
.It cannot be reproducible from user side right now.
around 0.05% users met this issue.
The text was updated successfully, but these errors were encountered: