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

SEGV_MAPERR when rolling back transaction #6945

Closed
JoyHong opened this issue Jun 11, 2020 · 8 comments
Closed

SEGV_MAPERR when rolling back transaction #6945

JoyHong opened this issue Jun 11, 2020 · 8 comments

Comments

@JoyHong
Copy link

JoyHong commented Jun 11, 2020

Goal

can commit transaction

Actual Results

throw exception and when cancel transaction, it crashes

Steps & Code to Reproduce

realm.beginTransaction();
try {
for (CallLog fixDeliveredCallLog : fixDeliveredCallLogs) {
fixDeliveredCallLog.setState(CallLog.STATE_DELIVERED);
}
if (deliveredCallLog != null) {
deliveredCallLog.setState(CallLog.STATE_DELIVERED);
ConversationManager.updateToConversation(realm, deliveredCallLog);
}
realm.commitTransaction();
} catch (Throwable e) {
if (realm.isInTransaction()) {
realm.cancelTransaction();
}
}

Version of Realm and tooling

Realm version(s): 7.0.0

Realm Sync feature enabled: No

Android Studio version: 3.6.3

Android Build Tools version: 3.3.2

Gradle version: 4.10.1

Which Android version and device(s): 三星 SM G570F、lg-v400、and so on

@JoyHong
Copy link
Author

JoyHong commented Jun 11, 2020

#00 pc 0014139e /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#1 pc 00141357 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#2 pc 000ab7c3 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#3 pc 00197953 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#4 pc 00199df7 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#5 pc 00103149 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#6 pc 00102863 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#7 pc 001027ad /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
#8 pc 000af5c1 /data/app-lib/pkgname-1/librealm-jni.so (Java_io_realm_internal_OsSharedRealm_nativeCancelTransaction+8) [armeabi-v7a]
10 #9 pc 0002054c /system/lib/libdvm.so (dvmPlatformInvoke+112) [armeabi-v7a]
11 #10 pc 0005132f /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398) [armeabi-v7a]
12 #11 pc 00052d95 /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184) [armeabi-v7a]
13 #12 pc 000299e0 /system/lib/libdvm.so [armeabi-v7a]
14 #13 pc 00030f48 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76) [armeabi-v7a]
15 #14 pc 0002e5e0 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184) [armeabi-v7a]
16 #15 pc 00063815 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336) [armeabi-v7a]
17 #16 pc 00063839 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20) [armeabi-v7a]
18 #17 pc 0005850f /system/lib/libdvm.so [armeabi-v7a]
19 #18 pc 0000d330 /system/lib/libc.so (__thread_entry+72) [armeabi-v7a]
20 #19 pc 0000d4c8 /system/lib/libc.so (pthread_create+240) [armeabi-v7a]

@JoyHong
Copy link
Author

JoyHong commented Jun 16, 2020

i don't why it will crash, before 7.0.0, it's ok.

@cmelchior
Copy link
Contributor

Can you reproduce this? Also, can you post the entire stacktrace?

@xiaojigugu
Copy link

Also in version :6.0.2
#702 SIGSEGV(SEGV_MAPERR)
#00 pc 000b4cb2 /apex/com.android.runtime/lib/libart.so [armeabi-v7a]

 #1 pc 000a8d2f /apex/com.android.runtime/lib/libart.so [armeabi-v7a]
 #2 pc 0009c15f /apex/com.android.runtime/lib/libart.so (art::gc::accounting::ModUnionTableReferenceCache::VisitObjects(void ()(art::mirror::Object, void*), void*)+218) [armeabi-v7a]
 #3 pc 000a5157 /apex/com.android.runtime/lib/libart.so (art::gc::collector::ConcurrentCopying::CopyingPhase()+758) [armeabi-v7a]
 #4 pc 000a3a33 /apex/com.android.runtime/lib/libart.so (art::gc::collector::ConcurrentCopying::RunPhases()+910) [armeabi-v7a]
 #5 pc 000b9e37 /apex/com.android.runtime/lib/libart.so (art::gc::collector::GarbageCollector::Run(art::gc::GcCause, bool)+222) [armeabi-v7a]
 #6 pc 000d1049 /apex/com.android.runtime/lib/libart.so (art::gc::Heap::CollectGarbageInternal(art::gc::collector::GcType, art::gc::GcCause, bool)+2544) [armeabi-v7a]
 #7 pc 000df007 /apex/com.android.runtime/lib/libart.so (art::gc::Heap::ConcurrentGC(art::Thread*, art::gc::GcCause, bool)+66) [armeabi-v7a]
 #8 pc 000e323b /apex/com.android.runtime/lib/libart.so (art_quick_alloc_string_from_chars_dlmalloc_instrumented+74) [armeabi-v7a]
 #9 pc 001046bb /apex/com.android.runtime/lib/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+30) [armeabi-v7a]
 #10 pc 0000193b /system/framework/arm/boot-core-libart.oat (oatdata+2363) [armeabi]

@cmelchior
Copy link
Contributor

From the OP:

#1 0x00141357 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::Array::init_from_mem(realm::MemRef)
/home/jenkins/workspace/realm_realm-core_release_6.0.4/build-android-armeabi-v7a-Release/../src/realm/array.cpp:223:26
#2 0x000ab7c3 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::Array::init_from_ref(unsigned int)
/Users/cm/Realm/realm-java-release/realm/realm-library/distribution/realm-core/core-5.0.3/include/realm/array.hpp:169:9
#3 0x00197953 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::Group::attach(unsigned int, bool, bool)
/home/jenkins/workspace/realm_realm-core_release_6.0.4/build-android-armeabi-v7a-Release/../src/realm/group.cpp:576:15
#4 0x00199df7 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::Group::advance_transact(unsigned int, unsigned int, realm::_impl::NoCopyInputStream&, bool)
/home/jenkins/workspace/realm_realm-core_release_6.0.4/build-android-armeabi-v7a-Release/../src/realm/group.cpp:1621:5
#5 0x00103149 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
void realm::Transaction::rollback_and_continue_as_read<realm::_impl::NullInstructionObserver>(realm::_impl::NullInstructionObserver*)
/Users/cm/Realm/realm-java-release/realm/realm-library/distribution/realm-core/core-5.0.3/include/realm/db.hpp:928:5
#6 0x00102863 /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::Transaction::rollback_and_continue_as_read()
/Users/cm/Realm/realm-java-release/realm/realm-library/distribution/realm-core/core-5.0.3/include/realm/db.hpp:576:9
#7 0x001027ad /data/app-lib/pkgname-1/librealm-jni.so [armeabi-v7a]
realm::_impl::transaction::cancel(realm::Transaction&, realm::BindingContext*)
/Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/object-store/src/impl/transact_log_handler.cpp:542:12
#8 0x000af5c1 /data/app-lib/pkgname-1/librealm-jni.so (Java_io_realm_internal_OsSharedRealm_nativeCancelTransaction+8) [armeabi-v7a]
                                                       Java_io_realm_internal_OsSharedRealm_nativeCancelTransaction
                                                       /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp:152:23
#9 0x0002054c /system/lib/libdvm.so (dvmPlatformInvoke+112) [armeabi-v7a]
#10 0x0005132f /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398) [armeabi-v7a]
#11 0x00052d95 /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184) [armeabi-v7a]
#12 0x000299e0 /system/lib/libdvm.so [armeabi-v7a]
#13 0x00030f48 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76) [armeabi-v7a]
#14 0x0002e5e0 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184) [armeabi-v7a]
#15 0x00063815 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336) [armeabi-v7a]
#16 0x00063839 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20) [armeabi-v7a]
#17 0x0005850f /system/lib/libdvm.so [armeabi-v7a]
#18 0x0000d330 /system/lib/libc.so (__thread_entry+72) [armeabi-v7a]
#19 0x0000d4c8 /system/lib/libc.so (pthread_create+240) [armeabi-v7a]

@cmelchior cmelchior changed the title 【Crash from v6.0.1 to v7.0.0】SIGSEGV(SEGV_MAPERR) SIGSEGV(SEGV_MAPERR): realm::Array::init_from_mem(realm::MemRef) Aug 26, 2020
@cmelchior cmelchior changed the title SIGSEGV(SEGV_MAPERR): realm::Array::init_from_mem(realm::MemRef) SEGV_MAPERR when rolling back transaction Aug 26, 2020
@cmelchior
Copy link
Contributor

cmelchior commented Aug 26, 2020

Talking to the Core team. Some fixes have been made in Realm Java 7.0.2 around memory management that might explain this. Can you try to upgrade to 7.0.2 and see if you can reproduce the issue there?

@sync-by-unito sync-by-unito bot closed this as completed Nov 6, 2020
@sync-by-unito
Copy link

sync-by-unito bot commented Nov 6, 2020

➤ Christan Melchior commented:

Closing due to no activity. Feel free to reopen this issue if it is still an issue.

@behdad222
Copy link

I have similar problems in realm 10.3.0

pid: 0, tid: 0 >>> com.nazdika.app <<<

backtrace:
  #00  pc 00000000000af18c  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 00000000001b5849  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 0000000000122dc1  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 00000000001cbcfb  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 00000000001ceb21  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 0000000000147fd7  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so
  #00  pc 00000000000d6b4d  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/lib/arm/librealm-jni.so (Java_io_realm_internal_OsSharedRealm_nativeCancelTransaction+8)
  #00  pc 0000000000052a6f  /data/app/com.nazdika.app--wfY_T0o93mdHBOEnLHnRw==/oat/arm/base.odex

@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

5 participants