-
Type: Bug
-
Resolution: Incomplete
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
SDK and version
SDK : Cocoa
Version: 10.30.0
Observations
- How frequent do the crash occur? Always
- Does it happen in production or during dev/test? All
- Can the crash be reproduced by you? Yes
- Can you provide instructions for how we can reproduce it?
I have 2 classes Transaction (contains date: Date, account: Account!) and Account (contains name: String).
I got a List<Transaction> and filter its date in specific month and then section by Calendar.current.startOfDay(for on its date. The app then crashes when I try to update the name of transaction.account.
Crash log / stacktrace
.../realm-core/src/realm/object-store/sectioned_results.cpp:86: [realm-core-12.7.0] Assertion failed: it != m_sectioned_results.m_prev_section_index_to_key.end()
0 LuyBuddy 0x00000001044c5e8c ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 LuyBuddy 0x00000001044c5d2e _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 238
2 LuyBuddy 0x0000000103f17dd5 _ZN5realm35SectionedResultsNotificationHandlerclERKNS_19CollectionChangeSetE + 661
3 LuyBuddy 0x0000000103f17af1 _ZN5realm24CollectionChangeCallback4ImplINS_35SectionedResultsNotificationHandlerEE5afterERKNS_19CollectionChangeSetE + 33
4 LuyBuddy 0x0000000103e1dd76 _ZN5realm24CollectionChangeCallback5afterERKNS_19CollectionChangeSetE + 38
5 LuyBuddy 0x0000000103e1dca2 ZZN5realm5_impl18CollectionNotifier13after_advanceEvENK3$_6clINS_4util17CheckedUniqueLockENS0_20NotificationCallbackEEEDaRT_RT0 + 466
6 LuyBuddy 0x0000000103e11358 ZN5realm5_impl18CollectionNotifier17for_each_callbackIZNS1_13after_advanceEvE3$_6EEvOT + 232
7 LuyBuddy 0x0000000103e11269 _ZN5realm5_impl18CollectionNotifier13after_advanceEv + 25
8 LuyBuddy 0x0000000103e43c6e _ZN5realm5_impl16RealmCoordinator23process_available_asyncERNS_5RealmE + 1054
9 LuyBuddy 0x0000000103fa9fc0 _ZN5realm5Realm6notifyEv + 352
10 LuyBuddy 0x0000000103e8ad60 _ZZN5realm5_impl17WeakRealmNotifier6notifyEvENK3$_0clEv + 64
11 LuyBuddy 0x0000000103e8ad15 ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZNS_5_impl17WeakRealmNotifier6notifyEvE3$_0EEvNSt3117integral_constantIbLb1EEERT + 21
12 LuyBuddy 0x0000000103e8ac19 _ZN5realm4util14UniqueFunctionIFvvEE12SpecificImplIZNS_5_impl17WeakRealmNotifier6notifyEvE3$_0E4callEv + 25
13 LuyBuddy 0x0000000103c6360a _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 106
14 LuyBuddy 0x00000001040d182b _ZN5realm4util15InvocationQueue10invoke_allEv + 155
15 LuyBuddy 0x00000001040d22b9 ZZN5realm4util16RunLoopSchedulerC1EP11_CFRunLoopENK3$_0clEPv + 25
16 LuyBuddy 0x00000001040d2295 ZZN5realm4util16RunLoopSchedulerC1EP11CFRunLoopEN3$_08_invokeEPv + 21
17 CoreFoundation 0x000000010cb36ebd CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
- 17
18 CoreFoundation 0x000000010cb36dfc __CFRunLoopDoSource0 + 157
19 CoreFoundation 0x000000010cb36659 __CFRunLoopDoSources0 + 308
20 CoreFoundation 0x000000010cb30db3 __CFRunLoopRun + 927
21 CoreFoundation 0x000000010cb30637 CFRunLoopRunSpecific + 560
22 GraphicsServices 0x000000011297428a GSEventRunModal + 139
23 UIKitCore 0x00000001215f9425 -[UIApplication _run] + 994
24 UIKitCore 0x00000001215fe301 UIApplicationMain + 123
25 libswiftUIKit.dylib 0x000000010ddfdc02 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
26 LuyBuddy 0x00000001034d8ce8 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 104
27 LuyBuddy 0x00000001034d8c6c $s8LuyBuddy11AppDelegateC5$mainyyFZ + 28
28 LuyBuddy 0x00000001034e2748 main + 24
29 dyld 0x00000001090bc2bf start_sim + 10
30 ??? 0x000000011299f52e 0x0 + 4607046958!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose2022-09-30 14:06:43.413222+0700 LuyBuddy[37105:263587] /Users/sereivoanyong/Library/Developer/Xcode/DerivedData/LuyBuddy-dgzlfwcubyoaydgaoojlhkyizypn/SourcePackages/checkouts/realm-core/src/realm/object-store/sectioned_results.cpp:86: [realm-core-12.7.0] Assertion failed: it != m_sectioned_results.m_prev_section_index_to_key.end()
0 LuyBuddy 0x00000001044c5e8c ZN5realm4utilL18terminate_internalERNSt3_118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1 LuyBuddy 0x00000001044c5d2e _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 238
2 LuyBuddy 0x0000000103f17dd5 _ZN5realm35SectionedResultsNotificationHandlerclERKNS_19CollectionChangeSetE + 661
3 LuyBuddy 0x0000000103f17af1 _ZN5realm24CollectionChangeCallback4ImplINS_35SectionedResultsNotificationHandlerEE5afterERKNS_19CollectionChangeSetE + 33
4 LuyBuddy 0x0000000103e1dd76 _ZN5realm24CollectionChangeCallback5afterERKNS_19CollectionChangeSetE + 38
5 LuyBuddy 0x0000000103e1dca2 ZZN5realm5_impl18CollectionNotifier13after_advanceEvENK3$_6clINS_4util17CheckedUniqueLockENS0_20NotificationCallbackEEEDaRT_RT0 + 466
6 LuyBuddy 0x0000000103e11358 ZN5realm5_impl18CollectionNotifier17for_each_callbackIZNS1_13after_advanceEvE3$_6EEvOT + 232
7 LuyBuddy 0x0000000103e11269 _ZN5realm5_impl18CollectionNotifier13after_advanceEv + 25
8 LuyBuddy 0x0000000103e43c6e _ZN5realm5_impl16RealmCoordinator23process_available_asyncERNS_5RealmE + 1054
9 LuyBuddy 0x0000000103fa9fc0 _ZN5realm5Realm6notifyEv + 352
10 LuyBuddy 0x0000000103e8ad60 _ZZN5realm5_impl17WeakRealmNotifier6notifyEvENK3$_0clEv + 64
11 LuyBuddy 0x0000000103e8ad15 ZN5realm4util14UniqueFunctionIFvvEE17call_regular_voidIZNS_5_impl17WeakRealmNotifier6notifyEvE3$_0EEvNSt3117integral_constantIbLb1EEERT + 21
12 LuyBuddy 0x0000000103e8ac19 _ZN5realm4util14UniqueFunctionIFvvEE12SpecificImplIZNS_5_impl17WeakRealmNotifier6notifyEvE3$_0E4callEv + 25
13 LuyBuddy 0x0000000103c6360a _ZNK5realm4util14UniqueFunctionIFvvEEclEv + 106
14 LuyBuddy 0x00000001040d182b _ZN5realm4util15InvocationQueue10invoke_allEv + 155
15 LuyBuddy 0x00000001040d22b9 ZZN5realm4util16RunLoopSchedulerC1EP11_CFRunLoopENK3$_0clEPv + 25
16 LuyBuddy 0x00000001040d2295 ZZN5realm4util16RunLoopSchedulerC1EP11CFRunLoopEN3$_08_invokeEPv + 21
17 CoreFoundation 0x000000010cb36ebd CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
18 CoreFoundation 0x000000010cb36dfc __CFRunLoopDoSource0 + 157
19 CoreFoundation 0x000000010cb36659 __CFRunLoopDoSources0 + 308
20 CoreFoundation 0x000000010cb30db3 __CFRunLoopRun + 927
21 CoreFoundation 0x000000010cb30637 CFRunLoopRunSpecific + 560
22 GraphicsServices 0x000000011297428a GSEventRunModal + 139
23 UIKitCore 0x00000001215f9425 -[UIApplication _run] + 994
24 UIKitCore 0x00000001215fe301 UIApplicationMain + 123
25 libswiftUIKit.dylib 0x000000010ddfdc02 $s5UIKit17UIApplicationMainys5Int32VAD_SpySpys4Int8VGGSgSSSgAJtF + 98
26 LuyBuddy 0x00000001034d8ce8 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 104
27 LuyBuddy 0x00000001034d8c6c $s8LuyBuddy11AppDelegateC5$mainyyFZ + 28
28 LuyBuddy 0x00000001034e2748 main + 24
29 dyld 0x00000001090bc2bf start_sim + 10
30 ??? 0x000000011299f52e 0x0 + 4607046958!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choose
Steps & Code to Reproduce
<!-- What steps/operations resulted in the crash? Please show any relevant code or steps that WE can
<!-- use to reproduce it. Even better is a full sample project that can reproduce the crash. -->
<!-- Code and files can be shared privately at help@realm.io if needed. -->
final class Transaction: Object { @Persisted var date: Date @Persisted var account: Account! var startOfDate: Date { return Calendar.current.startOfDay(for: date) } } final class Account: Object { @Persisted var name: String } /// I have a view controller observing this realm.objects(Transaction.self) .filter("date BETWEEN %@", // date range //) .sectioned(by: \.startOfDate, ascending: false) /// It then crashes when I try to update `account` linked to one of above transaction in another view controller. /// It works just fine if I don't section the transactions.