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

Native crash on realm-android 3.5.0 #5300

Closed
byronshlin opened this issue Sep 21, 2017 · 12 comments
Closed

Native crash on realm-android 3.5.0 #5300

byronshlin opened this issue Sep 21, 2017 · 12 comments

Comments

@byronshlin
Copy link

byronshlin commented Sep 21, 2017

Steps & Code to Reproduce

Logging is disabled on the device, I cannot know what operation caused this crash.
If I remove db and create new one ( clear user data on my app), the crash doesn't happen on new db.


#### Version of Realm and tooling
Realm version(s): ?
3.5.0

Realm sync feature enabled: yes/no
no
Android Studio version: ?
2.3.3
build.gradle on project level
       dependencies {
		classpath 'com.android.tools.build:gradle:2.3.3'
		classpath "io.realm:realm-gradle-plugin:3.5.0"
	}
Which Android version and device: ?
Sony G3125
Android SDK 24

#### Crash log

09-21 10:58:21.035  3095  3095 I AEE_AED : pid: 2976, tid: 3056, name: DTWRealmMgrThre  >>> (my app) <<<
09-21 10:58:21.035  3095  3095 I AEE_AED : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
09-21 10:58:21.035  3095  3095 I AEE_AED :     x0   0000000000000000  x1   0000000000000bf0  x2   0000000000000006  x3   0000000000000008
09-21 10:58:21.036  3095  3095 I AEE_AED :     x4   000000000000001d  x5   8080800000000000  x6   0000007094861000  x7   0000000000000000
09-21 10:58:21.036  3095  3095 I AEE_AED :     x8   0000000000000083  x9   ffffffffffffffdf  x10  0000000000000000  x11  0000000000000001
09-21 10:58:21.036  3095  3095 I AEE_AED :     x12  0000000000000018  x13  0000000000000000  x14  0000000000000000  x15  0036ece2d72d06ad
09-21 10:58:21.036  3095  3095 I AEE_AED :     x16  0000007091b76ed0  x17  0000007091b1f6d8  x18  0000000c00000000  x19  0000007074b434f8
09-21 10:58:21.036  3095  3095 I AEE_AED :     x20  0000000000000006  x21  0000007074b43450  x22  000000000000000b  x23  0000000000000001
09-21 10:58:21.036  3095  3095 I AEE_AED :     x24  0000007089d4b010  x25  0000000000000001  x26  0000000000000868  x27  0000007089c43980
09-21 10:58:21.036  3095  3095 I AEE_AED :     x28  0000000000000000  x29  0000007074b3f840  x30  0000007091b1cb04
09-21 10:58:21.036  3095  3095 I AEE_AED :     sp   0000007074b3f820  pc   0000007091b1f6e0  pstate 0000000060000000
09-21 10:58:21.044  3095  3095 I AEE_AED : 
09-21 10:58:21.044  3095  3095 I AEE_AED : backtrace:
09-21 10:58:21.044  3095  3095 I AEE_AED :     #00 pc 000000000006d6e0  /system/lib64/libc.so (tgkill+8)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #01 pc 000000000006ab00  /system/lib64/libc.so (pthread_kill+64)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #02 pc 0000000000024118  /system/lib64/libc.so (raise+24)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #03 pc 000000000001c9bc  /system/lib64/libc.so (abort+52)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #04 pc 00000000001e0e3c  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.044  3095  3095 I AEE_AED :     #05 pc 00000000001e0e80  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #06 pc 00000000001e0f10  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #07 pc 000000000018ec00  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #08 pc 000000000018bbd4  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #09 pc 000000000018be6c  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #10 pc 000000000018d614  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #11 pc 00000000000e8d68  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #12 pc 00000000000d2560  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #13 pc 000000000005ba20  /data/app/(my app)/lib/arm64/librealm-jni.so (Java_io_realm_internal_SharedRealm_nativeCommitTransaction+48)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #14 pc 0000000000ca5f14  /data/app/(my app)/oat/arm64/base.odex (offset 0xb21000)
09-21 11:11:17.435  7315  7315 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 7315 ((my app process))09-21 10:58:21.035  3095  3095 I AEE_AED : pid: 2976, tid: 3056, name: DTWRealmMgrThre  >>> (my app) <<<
09-21 10:58:21.035  3095  3095 I AEE_AED : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
09-21 10:58:21.035  3095  3095 I AEE_AED :     x0   0000000000000000  x1   0000000000000bf0  x2   0000000000000006  x3   0000000000000008
09-21 10:58:21.036  3095  3095 I AEE_AED :     x4   000000000000001d  x5   8080800000000000  x6   0000007094861000  x7   0000000000000000
09-21 10:58:21.036  3095  3095 I AEE_AED :     x8   0000000000000083  x9   ffffffffffffffdf  x10  0000000000000000  x11  0000000000000001
09-21 10:58:21.036  3095  3095 I AEE_AED :     x12  0000000000000018  x13  0000000000000000  x14  0000000000000000  x15  0036ece2d72d06ad
09-21 10:58:21.036  3095  3095 I AEE_AED :     x16  0000007091b76ed0  x17  0000007091b1f6d8  x18  0000000c00000000  x19  0000007074b434f8
09-21 10:58:21.036  3095  3095 I AEE_AED :     x20  0000000000000006  x21  0000007074b43450  x22  000000000000000b  x23  0000000000000001
09-21 10:58:21.036  3095  3095 I AEE_AED :     x24  0000007089d4b010  x25  0000000000000001  x26  0000000000000868  x27  0000007089c43980
09-21 10:58:21.036  3095  3095 I AEE_AED :     x28  0000000000000000  x29  0000007074b3f840  x30  0000007091b1cb04
09-21 10:58:21.036  3095  3095 I AEE_AED :     sp   0000007074b3f820  pc   0000007091b1f6e0  pstate 0000000060000000
09-21 10:58:21.044  3095  3095 I AEE_AED : 
09-21 10:58:21.044  3095  3095 I AEE_AED : backtrace:
09-21 10:58:21.044  3095  3095 I AEE_AED :     #00 pc 000000000006d6e0  /system/lib64/libc.so (tgkill+8)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #01 pc 000000000006ab00  /system/lib64/libc.so (pthread_kill+64)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #02 pc 0000000000024118  /system/lib64/libc.so (raise+24)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #03 pc 000000000001c9bc  /system/lib64/libc.so (abort+52)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #04 pc 00000000001e0e3c  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.044  3095  3095 I AEE_AED :     #05 pc 00000000001e0e80  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #06 pc 00000000001e0f10  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #07 pc 000000000018ec00  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #08 pc 000000000018bbd4  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #09 pc 000000000018be6c  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #10 pc 000000000018d614  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #11 pc 00000000000e8d68  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #12 pc 00000000000d2560  /data/app/(my app)/lib/arm64/librealm-jni.so
09-21 10:58:21.045  3095  3095 I AEE_AED :     #13 pc 000000000005ba20  /data/app/(my app)/lib/arm64/librealm-jni.so (Java_io_realm_internal_SharedRealm_nativeCommitTransaction+48)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #14 pc 0000000000ca5f14  /data/app/(my app)/oat/arm64/base.odex (offset 0xb21000)
09-21 11:11:17.435  7315  7315 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 7315 ((my app process))
@Zhuinden
Copy link
Contributor

Do you have the Realm file from when it causes this crash?

@beeender
Copy link
Contributor

parsed backtrace

09-21 10:58:21.044  3095  3095 I AEE_AED : backtrace:
09-21 10:58:21.044  3095  3095 I AEE_AED :     #00 pc 000000000006d6e0  /system/lib64/libc.so (tgkill+8)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #01 pc 000000000006ab00  /system/lib64/libc.so (pthread_kill+64)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #02 pc 0000000000024118  /system/lib64/libc.so (raise+24)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #03 pc 000000000001c9bc  /system/lib64/libc.so (abort+52)
09-21 10:58:21.044  3095  3095 I AEE_AED :     #04 pc 00000000001e0e3c  /data/app/(my app)/lib/arm64/librealm-jni.so please_report_this_error_to_help_at_realm_dot_io
09-21 10:58:21.044  3095  3095 I AEE_AED :     #05 pc 00000000001e0e80  /data/app/(my app)/lib/arm64/librealm-jni.so realm::util::terminate_internal(std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >&)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #06 pc 00000000001e0f10  /data/app/(my app)/lib/arm64/librealm-jni.so realm::util::terminate(char const*, char const*, long, std::initializer_list<realm::util::Printable>&&)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #07 pc 000000000018ec00  /data/app/(my app)/lib/arm64/librealm-jni.so  realm::GroupWriter::write_group()
09-21 10:58:21.045  3095  3095 I AEE_AED :     #08 pc 000000000018bbd4  /data/app/(my app)/lib/arm64/librealm-jni.so  realm::SharedGroup::low_level_commit(unsigned long)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #09 pc 000000000018be6c  /data/app/(my app)/lib/arm64/librealm-jni.so realm::SharedGroup::do_commit()
09-21 10:58:21.045  3095  3095 I AEE_AED :     #10 pc 000000000018d614  /data/app/(my app)/lib/arm64/librealm-jni.so realm::SharedGroup::commit_and_continue_as_read()
09-21 10:58:21.045  3095  3095 I AEE_AED :     #11 pc 00000000000e8d68  /data/app/(my app)/lib/arm64/librealm-jni.so realm::_impl::RealmCoordinator::commit_write(realm::Realm&)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #12 pc 00000000000d2560  /data/app/(my app)/lib/arm64/librealm-jni.so realm::Realm::commit_transaction()
09-21 10:58:21.045  3095  3095 I AEE_AED :     #13 pc 000000000005ba20  /data/app/(my app)/lib/arm64/librealm-jni.so (Java_io_realm_internal_SharedRealm_nativeCommitTransaction+48)
09-21 10:58:21.045  3095  3095 I AEE_AED :     #14 pc 0000000000ca5f14  /data/app/(my app)/oat/arm64/base.odex (offset 0xb21000)

@cmelchior
Copy link
Contributor

I created realm/realm-core#2866 so our Core people can take a look

@beeender
Copy link
Contributor

Should be the same issue reported to core realm/realm-core#2832

Same issue with #5178

The fix is in core 2.9.2. and 3.x.x which has not been released yet.

The current snapshot should contain the fix.

@nhachicha
Copy link
Collaborator

@byronshlin have you tried the fix? did it work?

@Zhuinden
Copy link
Contributor

Zhuinden commented Oct 7, 2017

also 4.0.0-RC1 contains the fix

@skienzl
Copy link

skienzl commented Oct 9, 2017

I think i got the same problem with 4.0.0-RC1. I am having a hard time reproducing it. Just happens from time to time an various devices. Afterwards i need to clean my app data, otherwise the app crashes after the start.
Also I pulled the realm file from the device and saw that it was 144MB big. But it should only be like 1MB.

10-09 20:33:29.866 15864-15864/? E/REALM: /home/jenkins/workspace/lm_realm-core_release_4.0.1-H662K7IA6U2B7ZK6DBECBDZYPHHQYXQ5UYSL7U2WUDUM5MVJKVQA@11/src/realm/group_writer.cpp:392: [realm-core-4.0.1] Assertion failed: ref + size <= after_ref with (ref, size, after_ref, ndx, m_free_positions.size()) =  [0, 8, 0, 0, 13]
                                          IMPORTANT: if you see this error, please send this log to help@realm.io.
10-09 20:33:29.879 15864-15864/? A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 15864 >> APP ID <<
10-09 20:33:29.949 15917-15917/? I/crash_dump64: obtaining output fd from tombstoned
10-09 20:33:29.959 3704-3704/? I//system/bin/tombstoned: received crash request for pid 15864
10-09 20:33:29.963 15917-15917/? I/crash_dump64: performing dump of process 15864 (target tid = 15864)
10-09 20:33:29.963 15917-15917/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-09 20:33:29.963 15917-15917/? A/DEBUG: Build fingerprint: 'google/angler/angler:8.0.0/OPR6.170623.019/4299446:user/release-keys'
10-09 20:33:29.963 15917-15917/? A/DEBUG: Revision: '0'
10-09 20:33:29.963 15917-15917/? A/DEBUG: ABI: 'arm64'
10-09 20:33:29.963 15917-15917/? A/DEBUG: pid: 15864, tid: 15864, name: .app.id  >>>  <<<
10-09 20:33:29.964 15917-15917/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x0   0000000000000000  x1   0000000000003df8  x2   0000000000000006  x3   0000000000000008
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x4   fefeff7ec8a7c37f  x5   fefeff7ec8a7c37f  x6   fefeff7ec8a7c37f  x7   7f7f7f7fffffffff
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x8   0000000000000083  x9   d03936e2d308e693  x10  0000000000000000  x11  0000000000000001
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x12  0000007fc9a8c4c8  x13  ffffffffffffffff  x14  ffffffffff000000  x15  ffffffffffffffff
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x16  000000722a3a22f8  x17  000000722a3441d4  x18  0000000000000000  x19  0000000000003df8
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x20  0000000000003df8  x21  000000720e415865  x22  000000720e415750  x23  00000072281a48f8
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x24  0000000000000000  x25  0000000000000001  x26  000000000000000c  x27  00000072281a3010
10-09 20:33:29.964 15917-15917/? A/DEBUG:     x28  0000007fc9a8cd38  x29  0000007fc9a8c8e0  x30  000000722a2f7780
10-09 20:33:29.964 15917-15917/? A/DEBUG:     sp   0000007fc9a8c8a0  pc   000000722a3441dc  pstate 0000000060000000
10-09 20:33:29.975 15917-15917/? A/DEBUG: backtrace:
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #00 pc 000000000006a1dc  /system/lib64/libc.so (tgkill+8)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #01 pc 000000000001d77c  /system/lib64/libc.so (abort+88)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #02 pc 00000000002acd48  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (please_report_this_error_to_help_at_realm_dot_io+8)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #03 pc 00000000002acd8c  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #04 pc 00000000002acf44  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (_ZN5realm4util19terminate_with_infoEPKcS2_lS2_OSt16initializer_listINS0_9PrintableEE+180)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #05 pc 000000000022a668  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (_ZN5realm11GroupWriter11write_groupEv+760)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #06 pc 0000000000227014  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (_ZN5realm11SharedGroup16low_level_commitEm+252)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #07 pc 00000000002272b4  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (_ZN5realm11SharedGroup9do_commitEv+76)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #08 pc 0000000000228d00  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (_ZN5realm11SharedGroup27commit_and_continue_as_readEv+84)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #09 pc 00000000001856c0  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #10 pc 000000000016acb8  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #11 pc 000000000016e160  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #12 pc 000000000018994c  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #13 pc 000000000016a984  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #14 pc 00000000000efc38  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/lib/arm64/librealm-jni.so (Java_io_realm_internal_SharedRealm_nativeGetSharedRealm+480)
10-09 20:33:29.975 15917-15917/? A/DEBUG:     #15 pc 0000000000040414  /data/app/com.app.id-RZig8sZ2uw5OiD3sOjnPAA==/oat/arm64/base.odex (offset 0x22000)```

@cmelchior
Copy link
Contributor

Thank you @skienzl. I have created realm/realm-core#2893 to track your case.

@cmelchior
Copy link
Contributor

A fix for this has been merged to master in 5.4.0-SNAPSHOT.
Also while investigating this bug we believe it should be possible to fix it on earlier versions by calling Realm.compact() on a Realm that throws this exception.

@growupzyg
Copy link

A fix for this has been merged to master in 5.4.0-SNAPSHOT.
Also while investigating this bug we believe it should be possible to fix it on earlier versions by calling Realm.compact() on a Realm that throws this exception.

I meet this error in 5.5.0 version.And I am using the Realm.compact() too,so how can i do,update to v6.0.0 version?

@growupzyg
Copy link

`realmConfig = new RealmConfiguration.Builder()
.name("library.realm")
.modules(new SPOSRealmModule())
.schemaVersion(version)
.migration(new Migration())
.compactOnLaunch(new CompactOnLaunchCallback() {
@OverRide
public boolean shouldCompact(long totalBytes, long usedBytes) {
// Compact if the file is over 5mb in size and less than 60% 'used'
long minSize = 10000 * 1024;
return (totalBytes > minSize) && (usedBytes / (double) totalBytes) < 0.6;
}
})
.build();

    Realm.setDefaultConfiguration(realmConfig);`

`private void cleanRealmCache() {
if (realmConfiguration != null) {
int localInstanceCount = Realm.getLocalInstanceCount(realmConfiguration);
int localInstanceCount1 = Realm.getGlobalInstanceCount(realmConfiguration);
if (localInstanceCount + localInstanceCount1 == 0) {
Realm.compactRealm(realmConfiguration);
}
}

}`

this is our code.

@cmelchior
Copy link
Contributor

Close as outdated. Also, issues created in Core have been closed, so most likely this has been fixed.

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

9 participants