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

Crashed during SwiftUI update: [realm-core-10.5.3] Invalid ref translation entry [0, 78187493520]

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • Q3-22FY
    • Affects Version/s: None
    • Component/s: None

      SDK and version

      SDK : RealmSwift
      Version: 10.7.0

      Observations

      • How frequent do the crash occur? After a write operation
      • Does it happen in production or during dev/test? Development.
      • Can the crash be reproduced by you? Yes.
      • Can you provide instructions for how we can reproduce it?

      Crash log / stacktrace

      /Users/adamek/Library/Developer/Xcode/DerivedData/FoodyRealmWorkspace-gjhtqvchxhxvxudedugbaamefhvu/SourcePackages/checkouts/realm-core/src/realm/alloc.hpp:585: [realm-core-10.5.3] Invalid ref translation entry [0, 78187493520]
      0 FoodyRealm 0x00000001033cdfc4 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
      1 FoodyRealm 0x00000001033ce228 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 240
      2 FoodyRealm 0x000000010296e418 ZN5realm4util9terminateIJylEEEvPKcS3_lDpT

      • 136
        3 FoodyRealm 0x000000010302fb58 _ZNK5realm9Allocator18translate_criticalEPNS0_14RefTranslationEm + 344
        4 FoodyRealm 0x0000000103026cb4 _ZNK5realm9Allocator9translateEm + 92
        5 FoodyRealm 0x000000010307f5e0 _ZN5realm14ArrayTimestamp13init_from_refEm + 40
        6 FoodyRealm 0x00000001031c2024 _ZNK5realm3Obj4_getINS_9TimestampEEET_NS_6ColKey3IdxE + 136
        7 FoodyRealm 0x00000001031c1f80 _ZNK5realm3Obj3getINS_9TimestampEEET_NS_6ColKeyE + 192
        8 FoodyRealm 0x0000000102969a50 ZN12_GLOBAL_N_18getBoxedIN5realm9TimestampEEEP11objc_objectP13RLMObjectBasem + 128
        9 FoodyRealm 0x00000001029699c4 __ZN12_GLOBAL_N_115makeBoxedGetterIN5realm9TimestampEEEP11objc_objectm_block_invoke + 40
        10 FoodyRealm 0x00000001028c8938 $s10FoodyRealm10StoresRootV14currentReceiptAC7SwiftUI7BindingVyAA07CurrentF0VG_tcfC + 520
        11 FoodyRealm 0x00000001027898fc $s10FoodyRealm8TabViewsV4bodyQrvg7SwiftUI4ViewPAEE3tagyQrqd_SHRdlFQOyAgEE7tabItemyQrqdyXEAeFRdlFQOyAA10StoresRootV_AE5LabelVyAE4TextVAE5ImageVGQoSiQo_yXEfU + 632
        12 SwiftUI 0x00000001a6137ebc $s7SwiftUI7TabViewV9selection7contentACyxq_GAA7BindingVyxGSg_q_yXEtcfC + 288
        13 FoodyRealm 0x0000000102788b84 $s10FoodyRealm8TabViewsV4bodyQrvg + 640
        14 FoodyRealm 0x000000010278a718 $s10FoodyRealm8TabViewsV7SwiftUI4ViewAadEP4body4BodyQzvgTW + 12
        15 SwiftUI 0x00000001a5f50fd4 9180D028-97A7-3208-978C-D268DC7D016C + 3747796
        16 SwiftUI 0x00000001a62f8030 9180D028-97A7-3208-978C-D268DC7D016C + 7577648
        17 SwiftUI 0x00000001a5f48f6c 9180D028-97A7-3208-978C-D268DC7D016C + 3714924
        18 SwiftUI 0x00000001a62f850c 9180D028-97A7-3208-978C-D268DC7D016C + 7578892
        19 SwiftUI 0x00000001a5f71c84 9180D028-97A7-3208-978C-D268DC7D016C + 3882116
        20 AttributeGraph 0x00000001c8b2677c D11631E1-C617-3A88-B2E2-73FCC8771D8D + 22396
        21 AttributeGraph 0x00000001c8b26bb4 D11631E1-C617-3A88-B2E2-73FCC8771D8D + 23476
        22 AttributeGraph 0x00000001c8b2fdc4 D11631E1-C617-3A88-B2E2-73FCC8771D8D + 60868
        23 SwiftUI 0x00000001a662af5c 9180D028-97A7-3208-978C-D268DC7D016C + 10932060
        24 SwiftUI 0x00000001a662dda4 9180D028-97A7-3208-978C-D268DC7D016C + 10943908
        25 SwiftUI 0x00000001a662c614 9180D028-97A7-3208-978C-D268DC7D016C + 10937876
        26 SwiftUI 0x00000001a6575e64 9180D028-97A7-3208-978C-D268DC7D016C + 10190436
        27 SwiftUI 0x00000001a656c804 9180D028-97A7-3208-978C-D268DC7D016C + 10151940
        28 SwiftUI 0x00000001a670a0b0 9180D028-97A7-3208-978C-D268DC7D016C + 11845808
        29 SwiftUI 0x00000001a670a0e4 9180D028-97A7-3208-978C-D268DC7D016C + 11845860
        30 UIKitCore 0x00000001a2618e70 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 17870448
        31 QuartzCore 0x00000001a2a9f69c 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1472156
        32 QuartzCore 0x00000001a2a9fb80 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1473408
        33 QuartzCore 0x00000001a2ab47b8 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1558456
        34 QuartzCore 0x00000001a29f6c44 62E5AE7A-DC92-335B-BB33-93D26145E072 + 781380
        35 QuartzCore 0x00000001a2a22e54 62E5AE7A-DC92-335B-BB33-93D26145E072 + 962132
        36 UIKitCore 0x00000001a210a66c 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 12568172
        37 CoreFoundation 0x000000019f66f490 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 664720
        38 CoreFoundation 0x000000019f6695b4 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 640436
        39 CoreFoundation 0x000000019f669b60 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 641888
        40 CoreFoundation 0x000000019f669210 CFRunLoopRunSpecific + 600
        41 GraphicsServices 0x00000001b6b81734 GSEventRunModal + 164
        42 UIKitCore 0x00000001a20d7978 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 12360056
        43 UIKitCore 0x00000001a20dd1e8 UIApplicationMain + 168
        44 SwiftUI 0x00000001a65b1eac 9180D028-97A7-3208-978C-D268DC7D016C + 10436268
        45 SwiftUI 0x00000001a65b1e38 9180D028-97A7-3208-978C-D268DC7D016C + 10436152
        46 SwiftUI 0x00000001a60a6b7c $s7SwiftUI3AppPAAE4mainyyFZ + 144
        47 FoodyRealm 0x0000000102716558 $s10FoodyRealm0aB3AppV5$mainyyFZ + 60
        48 FoodyRealm 0x00000001027165f8 main + 12
        49 libdyld.dylib 0x000000019f325cf8 9BCEFD51-E03A-36F0-A15C-6421AF610549 + 7416!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2021-03-13 04:28:05.820921-0500 FoodyRealm[2566:574939] /Users/adamek/Library/Developer/Xcode/DerivedData/FoodyRealmWorkspace-gjhtqvchxhxvxudedugbaamefhvu/SourcePackages/checkouts/realm-core/src/realm/alloc.hpp:585: [realm-core-10.5.3] Invalid ref translation entry [0, 78187493520]
        0 FoodyRealm 0x00000001033cdfc4 ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
        1 FoodyRealm 0x00000001033ce228 _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 240
        2 FoodyRealm 0x000000010296e418 ZN5realm4util9terminateIJylEEEvPKcS3_lDpT + 136
        3 FoodyRealm 0x000000010302fb58 _ZNK5realm9Allocator18translate_criticalEPNS0_14RefTranslationEm + 344
        4 FoodyRealm 0x0000000103026cb4 _ZNK5realm9Allocator9translateEm + 92
        5 FoodyRealm 0x000000010307f5e0 _ZN5realm14ArrayTimestamp13init_from_refEm + 40
        6 FoodyRealm 0x00000001031c2024 _ZNK5realm3Obj4_getINS_9TimestampEEET_NS_6ColKey3IdxE + 136
        7 FoodyRealm 0x00000001031c1f80 _ZNK5realm3Obj3getINS_9TimestampEEET_NS_6ColKeyE + 192
        8 FoodyRealm 0x0000000102969a50 ZN12_GLOBAL_N_18getBoxedIN5realm9TimestampEEEP11objc_objectP13RLMObjectBasem + 128
        9 FoodyRealm 0x00000001029699c4 __ZN12_GLOBAL_N_115makeBoxedGetterIN5realm9TimestampEEEP11objc_objectm_block_invoke + 40
        10 FoodyRealm 0x00000001028c8938 $s10FoodyRealm10StoresRootV14currentReceiptAC7SwiftUI7BindingVyAA07CurrentF0VG_tcfC + 520
        11 FoodyRealm 0x00000001027898fc $s10FoodyRealm8TabViewsV4bodyQrvg7SwiftUI4ViewPAEE3tagyQrqd_SHRdlFQOyAgEE7tabItemyQrqdyXEAeFRdlFQOyAA10StoresRootV_AE5LabelVyAE4TextVAE5ImageVGQoSiQo_yXEfU + 632
        12 SwiftUI 0x00000001a6137ebc $s7SwiftUI7TabViewV9selection7contentACyxq_GAA7BindingVyxGSg_q_yXEtcfC + 288
        13 FoodyRealm 0x0000000102788b84 $s10FoodyRealm8TabViewsV4bodyQrvg + 640
        14 FoodyRealm 0x000000010278a718 $s10FoodyRealm8TabViewsV7SwiftUI4ViewAadEP4body4BodyQzvgTW + 12
        15 SwiftUI 0x00000001a5f50fd4 9180D028-97A7-3208-978C-D268DC7D016C + 3747796
        16 SwiftUI 0x00000001a62f8030 9180D028-97A7-3208-978C-D268DC7D016C + 7577648
        17 SwiftUI 0x00000001a5f48f6c 9180D028-97A7-3208-978C-D268DC7D016C + 3714924
        18 SwiftUI 0x00000001a62f850c 9180D028-97A7-3208-978C-D268DC7D016C + 7578892
        19 SwiftUI 0x00000001a5f71c84 9180D028-97A7-3208-978C-D268DC7D016C + 3882116
        20 AttributeGraph 0x00000001c8b2677c D11631E1-C617-3A88-B2E2-73FCC8771D8D + 22396
        21 AttributeGraph 0x00000001c8b26bb4 D11631E1-C617-3A88-B2E2-73FCC8771D8D + 23476
        22 AttributeGraph 0x00000001c8b2fdc4 D11631E1-C617-3A88-B2E2-73FCC8771D8D + 60868
        23 SwiftUI 0x00000001a662af5c 9180D028-97A7-3208-978C-D268DC7D016C + 10932060
        24 SwiftUI 0x00000001a662dda4 9180D028-97A7-3208-978C-D268DC7D016C + 10943908
        25 SwiftUI 0x00000001a662c614 9180D028-97A7-3208-978C-D268DC7D016C + 10937876
        26 SwiftUI 0x00000001a6575e64 9180D028-97A7-3208-978C-D268DC7D016C + 10190436
        27 SwiftUI 0x00000001a656c804 9180D028-97A7-3208-978C-D268DC7D016C + 10151940
        28 SwiftUI 0x00000001a670a0b0 9180D028-97A7-3208-978C-D268DC7D016C + 11845808
        29 SwiftUI 0x00000001a670a0e4 9180D028-97A7-3208-978C-D268DC7D016C + 11845860
        30 UIKitCore 0x00000001a2618e70 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 17870448
        31 QuartzCore 0x00000001a2a9f69c 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1472156
        32 QuartzCore 0x00000001a2a9fb80 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1473408
        33 QuartzCore 0x00000001a2ab47b8 62E5AE7A-DC92-335B-BB33-93D26145E072 + 1558456
        34 QuartzCore 0x00000001a29f6c44 62E5AE7A-DC92-335B-BB33-93D26145E072 + 781380
        35 QuartzCore 0x00000001a2a22e54 62E5AE7A-DC92-335B-BB33-93D26145E072 + 962132
        36 UIKitCore 0x00000001a210a66c 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 12568172
        37 CoreFoundation 0x000000019f66f490 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 664720
        38 CoreFoundation 0x000000019f6695b4 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 640436
        39 CoreFoundation 0x000000019f669b60 B4FCD0AF-8F9F-3BAE-9813-952E09AFEAFC + 641888
        40 CoreFoundation 0x000000019f669210 CFRunLoopRunSpecific + 600
        41 GraphicsServices 0x00000001b6b81734 GSEventRunModal + 164
        42 UIKitCore 0x00000001a20d7978 6A574A63-4A31-33F2-BA61-0BC582AC9EB8 + 12360056
        43 UIKitCore 0x00000001a20dd1e8 UIApplicationMain + 168
        44 SwiftUI 0x00000001a65b1eac 9180D028-97A7-3208-978C-D268DC7D016C + 10436268
        45 SwiftUI 0x00000001a65b1e38 9180D028-97A7-3208-978C-D268DC7D016C + 10436152
        46 SwiftUI 0x00000001a60a6b7c $s7SwiftUI3AppPAAE4mainyyFZ + 144
        47 FoodyRealm 0x0000000102716558 $s10FoodyRealm0aB3AppV5$mainyyFZ + 60
        48 FoodyRealm 0x00000001027165f8 main + 12
        49 libdyld.dylib 0x000000019f325cf8 9BCEFD51-E03A-36F0-A15C-6421AF610549 + 7416!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose

      Steps & Code to Reproduce

      I think it's related to @ObservedResults

      @Binding var currentReceipt: CurrentReceipt
      // @ObservedResults(LedgersDB.self, filter: LedgersDB.openReceiptsPred, sortDescriptor: SortDescriptor(keyPath: "dateLedger", ascending: false)) var openReceipts
      var openReceipts: [LedgersDB]

      init(currentReceipt: Binding<CurrentReceipt>) {
          _currentReceipt = currentReceipt
          let thisRealm = currentReceipt.currentUser.wrappedValue.newRealm()!
          self.openReceipts = thisRealm.objects(LedgersDB.self).filter(LedgersDB.openReceiptsPred).sorted(by: { a, b in
              a.dateLedger > b.dateLedger
          })
      }
      

      When I replace
      @ObservedResults(LedgersDB.self, filter: LedgersDB.openReceiptsPred, sortDescriptor: SortDescriptor(keyPath: "dateLedger", ascending: false)) var openReceipts

      with

      var openReceipts: [LedgersDB]

      init(currentReceipt: Binding<CurrentReceipt>) {
          _currentReceipt = currentReceipt
          let thisRealm = currentReceipt.currentUser.wrappedValue.newRealm()!
          self.openReceipts = thisRealm.objects(LedgersDB.self).filter(LedgersDB.openReceiptsPred).sorted(by: { a, b in
              a.dateLedger > b.dateLedger
          })
      }
      

      The crash goes away.

            Assignee:
            jason.flax@mongodb.com Jason Flax
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: