Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-800

Crashing when inserting multiple data, more than 10k Objects

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      SDK and version

      SDK : Cocoa
      Version: 11.2.0

      Observations

      • How frequent do the crash occur?
        Everytime i try to start the app and load the data into the Realm Database
      • Does it happen in production or during dev/test?
        App is only on testing
      • Can the crash be reproduced by you?
        Not sure
      • Can you provide instructions for how we can reproduce it?
        i was trying to push 10k contact data into realm database, but i keep getting an error after a couple are inserted

      Crash log / stacktrace

      /Users/realm/workspace/realm_realm-core_release_11.2.0/src/realm/alloc.hpp:590: [realm-core-11.2.0] Invalid ref translation entry [0, 78187493520]
      0 Realm 0x00000001030e83e4 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
      1 Realm 0x00000001030e8688 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 328
      2 Realm 0x0000000102c1b7ec ZN5realm4util9terminateIJylEEEvPKcS3_lDpT

      • 136
        3 Realm 0x0000000102f722ac _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 788
        4 Realm 0x0000000102f73a98 _ZNK5realm11ClusterTree8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 96
        5 Realm 0x00000001030295d4 _ZNK5realm5Query8find_allERNS_14ConstTableViewEmmm + 928
        6 Realm 0x00000001030c62e4 _ZN5realm14ConstTableView7do_syncEv + 788
        7 Realm 0x00000001030297d4 _ZN5realm5Query8find_allEmmm + 124
        8 Realm 0x0000000103029c98 _ZN5realm5Query8find_allERKNS_18DescriptorOrderingE + 240
        9 Realm 0x00000001031dba68 _ZN5realm7Results27do_evaluate_query_if_neededEb + 196
        10 Realm 0x00000001031db4c4 _ZN5realm7Results7try_getINS_3ObjEEENS_4util8OptionalIT_EEm + 248
        11 Realm 0x00000001031db818 _ZN5realm7Results5firstINS_3ObjEEENS_4util8OptionalIT_EEv + 68
        12 Realm 0x0000000102ed346c ZZN5realm7Results5firstI18RLMAccessorContextEEDaRT_ENKUlS4_E_clIPNS_3ObjEEES3_S4 + 56
        13 Realm 0x0000000102ed26b0 ZN5realmL14switch_on_typeINS_3ObjEZNS_7Results5firstI18RLMAccessorContextEEDaRT_EUlS6_E_EES5_NS_12PropertyTypeEOT0 + 1308
        14 Realm 0x0000000102ed2188 ZNK5realm7Results8dispatchIZNS0_5firstI18RLMAccessorContextEEDaRT_EUlS5_E_EES4_OS5 + 68
        15 Realm 0x0000000102ed2138 ZN5realm7Results5firstI18RLMAccessorContextEEDaRT + 52
        16 Realm 0x0000000102ed20f8 _ZZ25-[RLMResults firstObject]ENK3$_8clEv + 40
        17 Realm 0x0000000102ecdb0c _ZL25translateRLMResultsErrorsIZ25-[RLMResults firstObject]E3$_8EDaOT_P8NSString + 36
        18 Realm 0x0000000102ecda90 -[RLMResults firstObject] + 124
        19 RealmSwift 0x0000000103fedb70 $s10RealmSwift7ResultsV5firstxSgvg + 96
        20 Contapp 0x00000001024e2c3c $s7Contapp12ContactUtilsC06insertB04snapySo15FIRDataSnapshotC_tF + 936
        21 Contapp 0x00000001024f91e4 $s7Contapp14ContactServiceC16registerContactsyyFySo15FIRDataSnapshotCcAA0B5UtilsCcfu0_yAFcfu1_ + 48
        22 Contapp 0x00000001024f9240 $sSo15FIRDataSnapshotCIegg_ABIeyBy_TR + 76
        23 FirebaseDatabase 0x00000001029f26e0 __63-[FIRDatabaseQuery observeEventType:withBlock:withCancelBlock:]_block_invoke + 96
        24 FirebaseDatabase 0x00000001029d58a4 __43-[FChildEventRegistration fireEvent:queue:]_block_invoke.62 + 124
        25 libdispatch.dylib 0x00000001044b3ce4 _dispatch_call_block_and_release + 24
        26 libdispatch.dylib 0x00000001044b5528 _dispatch_client_callout + 16
        27 libdispatch.dylib 0x00000001044c3994 _dispatch_main_queue_callback_4CF + 972
        28 CoreFoundation 0x00000001a0ce25e0 F3021642-E3C0-33F8-9911-DD303A6056D0 + 632288
        29 CoreFoundation 0x00000001a0cdca88 F3021642-E3C0-33F8-9911-DD303A6056D0 + 608904
        30 CoreFoundation 0x00000001a0cdbba0 CFRunLoopRunSpecific + 572
        31 GraphicsServices 0x00000001b7a44598 GSEventRunModal + 160
        32 UIKitCore 0x00000001a35cd2f4 CC6E5AC7-8248-35F6-8B42-2E25C93DCF0A + 11723508
        33 UIKitCore 0x00000001a35d2874 UIApplicationMain + 164
        34 SwiftUI 0x00000001a775b5dc 4F4DD786-8797-318B-ABDC-E05543CA0118 + 8922588
        35 SwiftUI 0x00000001a775b56c 4F4DD786-8797-318B-ABDC-E05543CA0118 + 8922476
        36 SwiftUI 0x00000001a732cd18 $s7SwiftUI3AppPAAE4mainyyFZ + 96
        37 Contapp 0x00000001024f9ab8 $s7Contapp0A3AppV5$mainyyFZ + 60
        38 Contapp 0x00000001024f9b58 main + 12
        39 libdyld.dylib 0x00000001a09ba568 0B475C78-3C12-3121-B7F8-2B95B83DAF44 + 5480!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2021-08-19 15:00:43.450848-0400 Contapp[2986:1266620] /Users/realm/workspace/realm_realm-core_release_11.2.0/src/realm/alloc.hpp:590: [realm-core-11.2.0] Invalid ref translation entry [0, 78187493520]
        0 Realm 0x00000001030e83e4 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
        1 Realm 0x00000001030e8688 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 328
        2 Realm 0x0000000102c1b7ec ZN5realm4util9terminateIJylEEEvPKcS3_lDpT + 136
        3 Realm 0x0000000102f722ac _ZNK5realm16ClusterNodeInner8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEEx + 788
        4 Realm 0x0000000102f73a98 _ZNK5realm11ClusterTree8traverseENS_4util11FunctionRefIFbPKNS_7ClusterEEEE + 96
        5 Realm 0x00000001030295d4 _ZNK5realm5Query8find_allERNS_14ConstTableViewEmmm + 928
        6 Realm 0x00000001030c62e4 _ZN5realm14ConstTableView7do_syncEv + 788
        7 Realm 0x00000001030297d4 _ZN5realm5Query8find_allEmmm + 124
        8 Realm 0x0000000103029c98 _ZN5realm5Query8find_allERKNS_18DescriptorOrderingE + 240
        9 Realm 0x00000001031dba68 _ZN5realm7Results27do_evaluate_query_if_neededEb + 196
        10 Realm 0x00000001031db4c4 _ZN5realm7Results7try_getINS_3ObjEEENS_4util8OptionalIT_EEm + 248
        11 Realm 0x00000001031db818 _ZN5realm7Results5firstINS_3ObjEEENS_4util8OptionalIT_EEv + 68
        12 Realm 0x0000000102ed346c ZZN5realm7Results5firstI18RLMAccessorContextEEDaRT_ENKUlS4_E_clIPNS_3ObjEEES3_S4 + 56
        13 Realm 0x0000000102ed26b0 ZN5realmL14switch_on_typeINS_3ObjEZNS_7Results5firstI18RLMAccessorContextEEDaRT_EUlS6_E_EES5_NS_12PropertyTypeEOT0 + 1308
        14 Realm 0x0000000102ed2188 ZNK5realm7Results8dispatchIZNS0_5firstI18RLMAccessorContextEEDaRT_EUlS5_E_EES4_OS5 + 68
        15 Realm 0x0000000102ed2138 ZN5realm7Results5firstI18RLMAccessorContextEEDaRT + 52
        16 Realm 0x0000000102ed20f8 _ZZ25-[RLMResults firstObject]ENK3$_8clEv + 40
        17 Realm 0x0000000102ecdb0c _ZL25translateRLMResultsErrorsIZ25-[RLMResults firstObject]E3$_8EDaOT_P8NSString + 36
        18 Realm 0x0000000102ecda90 -[RLMResults firstObject] + 124
        19 RealmSwift 0x0000000103fedb70 $s10RealmSwift7ResultsV5firstxSgvg + 96
        20 Contapp 0x00000001024e2c3c $s7Contapp12ContactUtilsC06insertB04snapySo15FIRDataSnapshotC_tF + 936
        21 Contapp 0x00000001024f91e4 $s7Contapp14ContactServiceC16registerContactsyyFySo15FIRDataSnapshotCcAA0B5UtilsCcfu0_yAFcfu1_ + 48
        22 Contapp 0x00000001024f9240 $sSo15FIRDataSnapshotCIegg_ABIeyBy_TR + 76
        23 FirebaseDatabase 0x00000001029f26e0 __63-[FIRDatabaseQuery observeEventType:withBlock:withCancelBlock:]_block_invoke + 96
        24 FirebaseDatabase 0x00000001029d58a4 __43-[FChildEventRegistration fireEvent:queue:]_block_invoke.62 + 124
        25 libdispatch.dylib 0x00000001044b3ce4 _dispatch_call_block_and_release + 24
        26 libdispatch.dylib 0x00000001044b5528 _dispatch_client_callout + 16
        27 libdispatch.dylib 0x00000001044c3994 _dispatch_main_queue_callback_4CF + 972
        28 CoreFoundation 0x00000001a0ce25e0 F3021642-E3C0-33F8-9911-DD303A6056D0 + 632288
        29 CoreFoundation 0x00000001a0cdca88 F3021642-E3C0-33F8-9911-DD303A6056D0 + 608904
        30 CoreFoundation 0x00000001a0cdbba0 CFRunLoopRunSpecific + 572
        31 GraphicsServices 0x00000001b7a44598 GSEventRunModal + 160
        32 UIKitCore 0x00000001a35cd2f4 CC6E5AC7-8248-35F6-8B42-2E25C93DCF0A + 11723508
        33 UIKitCore 0x00000001a35d2874 UIApplicationMain + 164
        34 SwiftUI 0x00000001a775b5dc 4F4DD786-8797-318B-ABDC-E05543CA0118 + 8922588
        35 SwiftUI 0x00000001a775b56c 4F4DD786-8797-318B-ABDC-E05543CA0118 + 8922476
        36 SwiftUI 0x00000001a732cd18 $s7SwiftUI3AppPAAE4mainyyFZ + 96
        37 Contapp 0x00000001024f9ab8 $s7Contapp0A3AppV5$mainyyFZ + 60
        38 Contapp 0x00000001024f9b58 main + 12
        39 libdyld.dylib 0x00000001a09ba568 0B475C78-3C12-3121-B7F8-2B95B83DAF44 + 5480!!!

      Steps & Code to Reproduce

      Can't share the complete code, but i can share the following

      ContactModel:
      final class ContactModel: Object, ObjectKeyIdentifiable {

      @Persisted(primaryKey: true) var phone: String = ""
      @Persisted var code: String = ""
      @Persisted var first_name: String = ""
      @Persisted var last_name: String = ""
      @Persisted var nick_name: String = ""
      @Persisted var company_name: String = ""
      @Persisted var emp_id: String = ""
      @Persisted var pos_id: String = ""
      @Persisted var sent: Int64 = 0
      @Persisted var is_main: Bool = false
      @Persisted var favorite: Bool = false
      @Persisted var name: String = ""
      

      }

      Trying to insert the data:
      let contactSnap = ContactModel().transformSnap(snap: snap)

          contactSnap.name =  contactSnap.first_name.isEmpty ? contactSnap.nick_name : contactSnap.first_name + " " + contactSnap.last_name
          let realm = try! Realm()
          try? realm.safeWrite  {
              realm.create(ContactModel.self,value: contactSnap,update: .modified)
          }
      

            Assignee:
            thomas.goyne@mongodb.com Thomas Goyne
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: