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

Crash: Top ref outside file #3133

Closed
cmelchior opened this issue Oct 30, 2018 · 5 comments
Closed

Crash: Top ref outside file #3133

cmelchior opened this issue Oct 30, 2018 · 5 comments

Comments

@cmelchior
Copy link
Contributor

cmelchior commented Oct 30, 2018

We are seeing a number of crash reports on the Java side that indicates the Realm file is somehow being corrupted. It is still unclear why this is happening, but the errors all have the same form but with different values:

Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1572864). top_ref[0]: 3031500000290E0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1572864). top_ref[0]: 3031500000290E0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

References to Java issues:

Current observations:

  • We can still not rule out completely this is happening due to the files being manipulated by code outside Realm's control, e.g. end app users users deleting or moving files or backup/restore procedures overwritting files.
  • There are few (if any) reports of this happening on other platforms which either indicates a general problem in the Java binding or the Android kernel.
  • It is happening across a wide variety of Android devices and versions indicating the problem is on our side.
  • This crash is seen together with Crash: Invalid mnemonic #3134. One observation is that this crash only seems to happen for the librarydb.realm while Crash: Invalid mnemonic #3134 only happens for the userdb.realm. This could indicate these files are somehow being handled differently as they become corrupted in different ways. I'm trying to verify this.

Crash data:

A list of exceptions and devices it is happening on can be seen here:

Searching 64 files for "(# OS Version(.|\n)*?)(^Fatal Exception: io.realm.exceptions.RealmFileException:.*Top ref outside file.*)" (regex)

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BAE7E84023E000137DD90DDE6F15B34_DNE_0_v2.txt:
   11  # Date: 2018-09-28T19:18:00Z
   12: # OS Version: 5.0
   13: # Device: Galaxy Note3
   14: # RAM Free: 10.2%
   15: # Disk Free: 25.3%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1572864). top_ref[0]: 3031500000290E0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1572864). top_ref[0]: 3031500000290E0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BB202D7034000013535D61B2F9DA377_DNE_0_v2.txt:
   11  # Date: 2018-10-01T11:24:00Z
   12: # OS Version: 5.1.1
   13: # Device: A37fw-International
   14: # RAM Free: 27.8%
   15: # Disk Free: 26.1%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 30315000001CF50, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1310720). top_ref[0]: 30315000001CF50, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BB5FDD002CC00012B75274C192E5BAC_DNE_0_v2.txt:
   11  # Date: 2018-10-04T11:47:00Z
   12: # OS Version: 6.0
   13: # Device: Moto X (2nd Gen)
   14: # RAM Free: 41.4%
   15: # Disk Free: 23.3%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 30315000002E258, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1310720). top_ref[0]: 30315000002E258, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BBBCEF802B40001135641921E922BA4_DNE_0_v2.txt:
   11  # Date: 2018-10-08T21:41:00Z
   12: # OS Version: 6.0.1
   13: # Device: Galaxy J3(2016)
   14: # RAM Free: 25.1%
   15: # Disk Free: 17.8%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 30315000001E1A0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1310720). top_ref[0]: 30315000001E1A0, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BC1151901DC00010A4E6EE47B4E538F_DNE_0_v2.txt:
   11  # Date: 2018-10-12T21:41:00Z
   12: # OS Version: 6.0
   13: # Device: Lenovo VIBE K10
   14: # RAM Free: 25.8%
   15: # Disk Free: < 1%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1572864). top_ref[0]: 303150000149BE8, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1572864). top_ref[0]: 303150000149BE8, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BC60D8800300001595FAE35550577BB_DNE_0_v2.txt:
   11  # Date: 2018-10-16T16:10:00Z
   12: # OS Version: 5.1.1
   13: # Device: Galaxy J3
   14: # RAM Free: 19.8%
   15: # Disk Free: 8.4%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1703936). top_ref[0]: 30315000001CC60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1703936). top_ref[0]: 30315000001CC60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BC67AC001480001776768A209AEAA27_DNE_0_v2.txt:
   11  # Date: 2018-10-16T23:56:00Z
   12: # OS Version: 7.1.1
   13: # Device: TA-1053
   14: # RAM Free: 36.2%
   15: # Disk Free: 19.8%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 303150000065E78, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1310720). top_ref[0]: 303150000065E78, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BC78A25023800010D762E937AF31253_DNE_0_v2.txt:
   11  # Date: 2018-10-17T19:14:00Z
   12: # OS Version: 8.0.0
   13: # Device: Galaxy S7
   14: # RAM Free: 23.6%
   15: # Disk Free: 30.3%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 303150000036140, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1310720). top_ref[0]: 303150000036140, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BC78AA803DC00017942AB1C91A5C805_DNE_1_v2.txt:
   11  # Date: 2018-10-17T19:17:00Z
   12: # OS Version: 8.0.0
   13: # Device: Galaxy S7 Edge
   14: # RAM Free: 37.5%
   15: # Disk Free: 5%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1441792). top_ref[0]: 30315000001C820, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1441792). top_ref[0]: 30315000001C820, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BCE1F5D038700010723F4E1D0F0A8DE_DNE_0_v2.txt:
   11  # Date: 2018-10-22T19:05:00Z
   12: # OS Version: 5.1
   13: # Device: HTC_D728x
   14: # RAM Free: 40.5%
   15: # Disk Free: 34.9%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 303150000126B60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1310720). top_ref[0]: 303150000126B60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BD136A700C100013C5973B244A0041A_DNE_0_v2.txt:
   11  # Date: 2018-10-25T03:21:00Z
   12: # OS Version: 7.1.1
   13: # Device: Moto G4 Play
   14: # RAM Free: 22.6%
   15: # Disk Free: 4.2%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1703936). top_ref[0]: 303150000023400, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1. (Top ref outside file (size = 1703936). top_ref[0]: 303150000023400, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 1) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BD42CB003510001111430F3313C4B19_DNE_0_v2.txt:
   11  # Date: 2018-10-27T09:15:00Z
   12: # OS Version: 6.0.1
   13: # Device: OnePlus2
   14: # RAM Free: 27.1%
   15: # Disk Free: 23.3%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 303150000024E60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1310720). top_ref[0]: 303150000024E60, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

/Users/cm/Downloads/User Realm Crashes/com.test_issue_2727_crash_5BD6CC31012D000122EDB4A9406396E0_DNE_0_v2.txt:
   11  # Date: 2018-10-29T09:00:00Z
   12: # OS Version: 6.0.1
   13: # Device: Galaxy On5
   14: # RAM Free: 20.8%
   15: # Disk Free: 20.8%
   16: 
   17: 
   18: Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.test/files/librarydb.realm': Top ref outside file (size = 1310720). top_ref[0]: 303150000031878, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0. (Top ref outside file (size = 1310720). top_ref[0]: 303150000031878, top_ref[1]: 46020200, mnemonic: 54 2D 44 42, fmt[0]: 9, fmt[1]: 9, flags: 0) (/data/data/com.test/files/librarydb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101

13 matches across 13 files
@jedelbo
Copy link
Contributor

jedelbo commented Oct 31, 2018

It is remarkable that ref[1] is always 46020200 and ref[0] values are prefixed with the same number. Current ref is, however , both 0 and 1.

@cmelchior
Copy link
Contributor Author

cmelchior commented Oct 31, 2018

I suspect that librarydb.realm is being shipped with the app which also explains why it has the exact same size on a lot of the devices, but I'm trying to get that verified.

EDIT: It is not being shipped with the app.

@wooseopkim
Copy link

Any progress, or workaround reported on this issue? Huge number of our users can't even open the (Android) application because of this problem.

@jedelbo
Copy link
Contributor

jedelbo commented Feb 11, 2019

We would need to know more about the steps that lead to this situation. Perhaps retrieving one of the infected file could also help finding out what goes wrong.

@RealmBot
Copy link
Collaborator

➤ Finn Andersen commented:

Most likely fixed by #3429 ( #3429 )

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 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

6 participants