weixin_39743423
weixin_39743423
2020-12-09 03:57

Core6: transaction.import_copy_of crash when deleting parent of LinkView

I have some tests involving deleting the parent of LinkView failing:

Example accessors_resultsBuiltOnDeletedLinkView_deletionAsALocalCommit and changeListener_onResultsBuiltOnDeletedLinkView

both cover the same logic, say you have type Owner that contains aRealmList of Dog, you query for all dogs of this owner, then register a listener on the RealmResults. Now delete all owners, this will trigger the listeners, but accessing the the list of dogs (ex: size) will crash. I traced back this to be triggered by the call to m_notifier->get_tableview(m_table_view); introduced in https://github.com/realm/realm-object-store/commit/eafdd48580816f02cc8a1da743421c4e6e988f99#diff-c0354faf99b53cc5d3c9e6a58ed9ae85

Here's the crash


08-12 12:17:49.093  5407  5425 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x29c in tid 5425 (RunTestInLooper)
08-12 12:17:49.107  5430  5430 I crash_dump32: obtaining output fd from tombstoned
08-12 12:17:49.108   144   144 I /system/bin/tombstoned: received crash request for pid 5407
08-12 12:17:49.108  5430  5430 I crash_dump32: performing dump of process 5407 (target tid = 5425)
08-12 12:17:49.108  5430  5430 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-12 12:17:49.108  5430  5430 F DEBUG   : Build fingerprint: 'Android/vbox86p/vbox86p:8.0.0/OPR6.170623.017/32:userdebug/test-keys'
08-12 12:17:49.108  5430  5430 F DEBUG   : Revision: '0'
08-12 12:17:49.108  5430  5430 F DEBUG   : ABI: 'x86'
08-12 12:17:49.108  5430  5430 F DEBUG   : pid: 5407, tid: 5425, name: RunTestInLooper  >>> io.realm.test <<<
08-12 12:17:49.108  5430  5430 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c
08-12 12:17:49.108  5430  5430 F DEBUG   : Cause: null pointer dereference
08-12 12:17:49.108  5430  5430 F DEBUG   :     eax 00000000  ebx ce210df0  ecx ce7912b8  edx 00000000
08-12 12:17:49.108  5430  5430 F DEBUG   :     esi e06faf00  edi e06c8498
08-12 12:17:49.108  5430  5430 F DEBUG   :     xcs 00000023  xds 0000002b  xes 0000002b  xfs 0000006b  xss 0000002b
08-12 12:17:49.108  5430  5430 F DEBUG   :     eip ce056a7b  ebp ce791268  esp ce791268  flags 00010296
08-12 12:17:49.110  5430  5430 F DEBUG   :
08-12 12:17:49.110  5430  5430 F DEBUG   : backtrace:
08-12 12:17:49.110  5430  5430 F DEBUG   :     #00 pc 00416a7b  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZNK5realm5Table7get_keyEv+9)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #01 pc 0034a474  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZNK5realm8ConstObj13get_table_keyEv+46)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #02 pc 0031866d  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERKNS_8ConstObjE+37)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #03 pc 003188b2  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERKSt10unique_ptrINS_6LnkLstESt14default_deleteIS2_EE+106)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #04 pc 00357f13  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2EPKS0_PNS_11TransactionENS_13PayloadPolicyE+285)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #05 pc 004291d8  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+50)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #06 pc 0042934e  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm14ConstTableViewC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+304)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #07 pc 00312ac6  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm9TableViewC2ERKNS_14ConstTableViewEPNS_11TransactionENS_13PayloadPolicyE+50)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #08 pc 00312b19  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZNK5realm9TableView18clone_for_handoverEPNS_11TransactionENS_13PayloadPolicyE+63)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #09 pc 00318ab2  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERNS_9TableViewENS_13PayloadPolicyE+38)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #10 pc 00161afb  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm5_impl15ResultsNotifier13get_tableviewERNS_9TableViewE+129)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #11 pc 00132ba1  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm7Results24evaluate_query_if_neededEb+1611)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #12 pc 00132cf1  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (_ZN5realm7Results4sizeEv+209)
08-12 12:17:49.110  5430  5430 F DEBUG   :     #13 pc 000808c5  /data/app/io.realm.test-wnm1NLfkHaz5x_TauTrKDA==/lib/x86/librealm-jni.so (Java_io_realm_internal_OsResults_nativeSize+252)

Another similar use case is https://github.com/realm/realm-java/blob/3aaf5db578083ffacf858bdb95075ddfd7fa3458/realm/realm-library/src/androidTest/java/io/realm/RealmResultsTests.java#L346


08-12 13:45:41.595  6989  7009 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x29c in tid 7009 (RunTestInLooper)
08-12 13:45:41.631  7014  7014 I crash_dump32: obtaining output fd from tombstoned
08-12 13:45:41.632   144   144 I /system/bin/tombstoned: received crash request for pid 6989
08-12 13:45:41.632  7014  7014 I crash_dump32: performing dump of process 6989 (target tid = 7009)
08-12 13:45:41.633  7014  7014 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-12 13:45:41.633  7014  7014 F DEBUG   : Build fingerprint: 'Android/vbox86p/vbox86p:8.0.0/OPR6.170623.017/32:userdebug/test-keys'
08-12 13:45:41.633  7014  7014 F DEBUG   : Revision: '0'
08-12 13:45:41.633  7014  7014 F DEBUG   : ABI: 'x86'
08-12 13:45:41.633  7014  7014 F DEBUG   : pid: 6989, tid: 7009, name: RunTestInLooper  >>> io.realm.test <<<
08-12 13:45:41.633  7014  7014 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29c
08-12 13:45:41.633  7014  7014 F DEBUG   : Cause: null pointer dereference
08-12 13:45:41.633  7014  7014 F DEBUG   :     eax 00000000  ebx ce213df0  ecx c9a7f178  edx 00000000
08-12 13:45:41.633  7014  7014 F DEBUG   :     esi e06faa00  edi e06fa8c0
08-12 13:45:41.633  7014  7014 F DEBUG   :     xcs 00000023  xds 0000002b  xes 0000002b  xfs 0000006b  xss 0000002b
08-12 13:45:41.633  7014  7014 F DEBUG   :     eip ce059a7b  ebp c9a7f128  esp c9a7f128  flags 00010296
08-12 13:45:41.637  7014  7014 F DEBUG   :
08-12 13:45:41.637  7014  7014 F DEBUG   : backtrace:
08-12 13:45:41.637  7014  7014 F DEBUG   :     #00 pc 00416a7b  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZNK5realm5Table7get_keyEv+9)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #01 pc 0034a474  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZNK5realm8ConstObj13get_table_keyEv+46)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #02 pc 0031866d  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERKNS_8ConstObjE+37)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #03 pc 003188b2  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERKSt10unique_ptrINS_6LnkLstESt14default_deleteIS2_EE+106)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #04 pc 00357f13  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2EPKS0_PNS_11TransactionENS_13PayloadPolicyE+285)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #05 pc 004291d8  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+50)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #06 pc 0042934e  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm14ConstTableViewC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+304)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #07 pc 00312a5f  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZNK5realm14ConstTableView18clone_for_handoverEPNS_11TransactionENS_13PayloadPolicyE+63)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #08 pc 00318ae4  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm11Transaction14import_copy_ofERNS_14ConstTableViewENS_13PayloadPolicyE+38)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #09 pc 00357e9b  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2EPKS0_PNS_11TransactionENS_13PayloadPolicyE+165)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #10 pc 004291d8  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5QueryC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+50)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #11 pc 0042934e  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm14ConstTableViewC2ERKS0_PNS_11TransactionENS_13PayloadPolicyE+304)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #12 pc 001627d5  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5_impl15ResultsNotifier19do_prepare_handoverERNS_11TransactionE+159)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #13 pc 0014d4f0  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5_impl18CollectionNotifier16prepare_handoverEv+138)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #14 pc 001611e7  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5_impl16RealmCoordinator19run_async_notifiersEv+2983)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #15 pc 001613e5  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5_impl16RealmCoordinator9on_changeEv+31)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #16 pc 001702ee  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZN5realm5_impl20ExternalCommitHelper12DaemonThread6listenEv+294)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #17 pc 00170357  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (_ZNSt6thread5_ImplISt12_Bind_simpleIFZN5realm5_impl20ExternalCommitHelper12DaemonThreadC4EvEUlvE_vEEE6_M_runEv+33)
08-12 13:45:41.637  7014  7014 F DEBUG   :     #18 pc 00487c4e  /data/app/io.realm.test-BtWNPvwVC78UM5qYzsJd9w==/lib/x86/librealm-jni.so (execute_native_thread_routine+46)

both crashes seem to point to https://github.com/realm/realm-object-store/blob/tg/core-6-cocoa/src/impl/results_notifier.cpp#L194

cc

Note: using tg/core-6-cocoa

该提问来源于开源项目:realm/realm-object-store

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

6条回答

  • weixin_39956350 weixin_39956350 5月前

    So far I failed in creating a unit case only in Object Store, I'm probably missing some subtle difference that Java is doing, but it is unclear.

    I can, however, run the debugger against the error in Java.

    Here are a couple of screen shoots. Maybe they can provide some hint into what is wrong?

    image image

    点赞 评论 复制链接分享
  • weixin_39528843 weixin_39528843 5月前

    It is hard to tell what could be wrong from these pictures. Perhaps we should try to debug the problem together next time is in Cph.

    点赞 评论 复制链接分享
  • weixin_39956350 weixin_39956350 5月前

    Yes, that was my thinking as well. It is probably faster that way and this issue doesn't seem super blocking.

    点赞 评论 复制链接分享
  • weixin_39528843 weixin_39528843 5月前
    点赞 评论 复制链接分享
  • weixin_39743423 weixin_39743423 5月前

    ~~No crash observed in core-6 branch~~

    点赞 评论 复制链接分享
  • weixin_39743423 weixin_39743423 5月前

    this still crashes on accessors_resultsBuiltOnDeletedLinkView_deletionAsARemoteCommit test

    点赞 评论 复制链接分享

相关推荐