Insta crash upon opening the app
How frequently does the bug occur?
All the time
Description
We have had users report this crash before but couldn't get a crash report probably because it happens too early, and now I got this insta crash every time I open the app on M1 macOS running the MacCatalyst version of the app. The app was updated over a month ago and was working fine until yesterday, when all of a sudden it started to crash every time trying to open. I could see the app UI with entries from Realm for like half a second then it crashes, which means the initial loading was finished within Realm.
Stacktrace & log output
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: MyApp [27218]
Path: /Applications/MyApp.app/Contents/MacOS/MyApp
Identifier: hyouuu.myapp
Version: 6.1.5 (167)
App Item ID: 805451002
App External ID: 851211921
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2022-09-28 12:01:23.8469 -0700
OS Version: macOS 12.6 (21G115)
Report Version: 12
Anonymous UUID: 52764A18-7F3B-5DB3-1ADC-8818FDB2FAA5
Sleep/Wake UUID: EA7C06E8-40A2-4CC2-9C17-79C6DB5CF2AA
Time Awake Since Boot: 33000 seconds
Time Since Wake: 10558 seconds
System Integrity Protection: enabled
Crashed Thread: 3 Dispatch queue: hyouuu.myapp.bgQueue
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
abort() called
Application Specific Backtrace 0:
0 CoreFoundation 0x000000019bb79148 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x000000019b8c3e04 objc_exception_throw + 60
2 Realm 0x0000000106b60360 _Z20RLMThrowResultsErrorP8NSString + 436
3 Realm 0x0000000106b605dc -[RLMResults count] + 44
4 RealmSwift 0x0000000105653e04 $s10RealmSwift0A14CollectionImplPAAE5countSivg + 36
5 MyApp 0x00000001048fcb44 MyApp + 1493828
6 MyApp 0x00000001048ffaa4 MyApp + 1505956
7 MyApp 0x0000000104907400 MyApp + 1537024
8 MyApp 0x0000000104876384 MyApp + 942980
9 MyApp 0x000000010490741c MyApp + 1537052
10 libswiftObjectiveC.dylib 0x00000001b064bad4 $s10ObjectiveC15autoreleasepool8invokingxxyKXE_tKlF + 64
11 MyApp 0x00000001048ff5e8 MyApp + 1504744
12 MyApp 0x0000000104907264 MyApp + 1536612
13 MyApp 0x0000000104b299cc MyApp + 3774924
14 MyApp 0x0000000104b2a7ec MyApp + 3778540
15 MyApp 0x0000000104afc654 MyApp + 3589716
16 libdispatch.dylib 0x000000019b876fb4 _dispatch_block_async_invoke2 + 148
17 libdispatch.dylib 0x000000019b8681b4 _dispatch_client_callout + 20
18 libdispatch.dylib 0x000000019b86f8a8 _dispatch_lane_serial_drain + 668
19 libdispatch.dylib 0x000000019b870438 _dispatch_lane_invoke + 444
20 libdispatch.dylib 0x000000019b87ac98 _dispatch_workloop_worker_thread + 648
21 libsystem_pthread.dylib 0x000000019ba28360 _pthread_wqthread + 288
22 libsystem_pthread.dylib 0x000000019ba27080 start_wqthread + 8
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x19b9f1738 __psynch_mutexwait + 8
1 libsystem_pthread.dylib 0x19ba29384 _pthread_mutex_firstfit_lock_wait + 84
2 libsystem_pthread.dylib 0x19ba26cf8 _pthread_mutex_firstfit_lock_slow + 248
3 AddressBookCore 0x1ad515ad8 _AB_Lock + 172
4 AddressBookCore 0x1ad51deec +[ABAddressBook abGlobalAPILockInFile:line:contextBlock:togglingSuddenTermination:] + 112
5 AddressBookCore 0x1ad51de60 -[ABAddressBook(ABAddressBook_CoreData_Private) abGlobalAPILockInFile:line:togglingSuddenTermination:] + 156
6 AddressBookCore 0x1ad5983d4 -[ABAddressBook _vacuum] + 44
7 CoreFoundation 0x19baed468 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
8 CoreFoundation 0x19bb91bb8 ___CFXRegistrationPost_block_invoke + 52
9 CoreFoundation 0x19bb91b24 _CFXRegistrationPost + 456
10 CoreFoundation 0x19babc0f8 _CFXNotificationPost + 732
11 Foundation 0x19c981c28 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
12 AddressBookCore 0x1ad566b04 __95-[ABAccountRepository postDidChangeNotificationWithAccounts:includingContactStoreNotification:]_block_invoke + 136
13 ContactsFoundation 0x1ad4544ec __63-[_CNJumpToMainRunLoopScheduler performBlock:qualityOfService:]_block_invoke + 44
14 CoreFoundation 0x19baf8a54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28
15 CoreFoundation 0x19baf88cc __CFRunLoopDoBlocks + 412
16 CoreFoundation 0x19baf78dc __CFRunLoopRun + 1720
17 CoreFoundation 0x19baf6a84 CFRunLoopRunSpecific + 600
18 HIToolbox 0x1a4736338 RunCurrentEventLoopInMode + 292
19 HIToolbox 0x1a47360b4 ReceiveNextEventCommon + 564
20 HIToolbox 0x1a4735e68 _BlockUntilNextEventMatchingListInModeWithFilter + 72
21 AppKit 0x19e65e51c _DPSNextEvent + 860
22 AppKit 0x19e65ce14 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328
23 AppKit 0x19e64efe0 -[NSApplication run] + 596
24 AppKit 0x19e6206fc NSApplicationMain + 1132
25 AppKit 0x19e8f6640 _NSApplicationMainWithInfoDictionary + 24
26 UIKitMacHelper 0x1b13bc3c0 UINSApplicationMain + 1276
27 UIKitCore 0x1c3b59c40 UIApplicationMain + 164
28 MyApp 0x104795038 0x104790000 + 20536
29 dyld 0x10510908c start + 520
Thread 1:
0 libsystem_pthread.dylib 0x19ba27078 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x19ba27078 start_wqthread + 0
Thread 3 Crashed:: Dispatch queue: hyouuu.myapp.bgQueue
0 libsystem_kernel.dylib 0x19b9f6d98 __pthread_kill + 8
1 libsystem_pthread.dylib 0x19ba2bee0 pthread_kill + 288
2 libsystem_c.dylib 0x19b966340 abort + 168
3 libc++abi.dylib 0x19b9e6b08 abort_message + 132
4 libc++abi.dylib 0x19b9d6950 demangling_terminate_handler() + 336
5 libobjc.A.dylib 0x19b8cc320 _objc_terminate() + 144
6 libc++abi.dylib 0x19b9e5ea4 std::__terminate(void (*)()) + 20
7 libc++abi.dylib 0x19b9e5e40 std::terminate() + 64
8 libdispatch.dylib 0x19b8681c8 _dispatch_client_callout + 40
9 libdispatch.dylib 0x19b86f8a8 _dispatch_lane_serial_drain + 668
10 libdispatch.dylib 0x19b870438 _dispatch_lane_invoke + 444
11 libdispatch.dylib 0x19b87ac98 _dispatch_workloop_worker_thread + 648
12 libsystem_pthread.dylib 0x19ba28360 _pthread_wqthread + 288
13 libsystem_pthread.dylib 0x19ba27080 start_wqthread + 8
Thread 4:
0 libsystem_pthread.dylib 0x19ba27078 start_wqthread + 0
Thread 5:: Dispatch queue: com.apple.root.background-qos
0 libsystem_kernel.dylib 0x19b9f1738 __psynch_mutexwait + 8
1 libsystem_pthread.dylib 0x19ba29384 _pthread_mutex_firstfit_lock_wait + 84
2 libsystem_pthread.dylib 0x19ba26cf8 _pthread_mutex_firstfit_lock_slow + 248
3 AddressBookCore 0x1ad515ad8 _AB_Lock + 172
4 AddressBookCore 0x1ad515968 +[ABAddressBook sharedAddressBook] + 52
5 Contacts 0x1ad66ff24 __28+[CNContactStore initialize]_block_invoke_2 + 240
6 libdispatch.dylib 0x19b876fb4 _dispatch_block_async_invoke2 + 148
7 libdispatch.dylib 0x19b8681b4 _dispatch_client_callout + 20
8 libdispatch.dylib 0x19b879a04 _dispatch_root_queue_drain + 680
9 libdispatch.dylib 0x19b87a104 _dispatch_worker_thread2 + 164
10 libsystem_pthread.dylib 0x19ba28324 _pthread_wqthread + 228
11 libsystem_pthread.dylib 0x19ba27080 start_wqthread + 8
Thread 6:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x19b9ee8b0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x19b9eed20 mach_msg + 76
2 CoreFoundation 0x19baf9210 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x19baf76c0 __CFRunLoopRun + 1180
4 CoreFoundation 0x19baf6a84 CFRunLoopRunSpecific + 600
5 Foundation 0x19c9dc0c0 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236
6 Foundation 0x19ca670ac -[NSRunLoop(NSRunLoop) runUntilDate:] + 124
7 UIKitCore 0x1c3b5b3bc -[UIEventFetcher threadMain] + 156
8 Foundation 0x19c9d45cc __NSThread__start__ + 808
9 libsystem_pthread.dylib 0x19ba2c26c _pthread_start + 148
10 libsystem_pthread.dylib 0x19ba2708c thread_start + 8
Thread 7:
0 libsystem_pthread.dylib 0x19ba27078 start_wqthread + 0
Thread 8:: Dispatch queue: com.apple.root.background-qos
0 libsystem_kernel.dylib 0x19b9f1738 __psynch_mutexwait + 8
1 libsystem_pthread.dylib 0x19ba29384 _pthread_mutex_firstfit_lock_wait + 84
2 libsystem_pthread.dylib 0x19ba26cf8 _pthread_mutex_firstfit_lock_slow + 248
3 AddressBookCore 0x1ad515ad8 _AB_Lock + 172
4 AddressBookCore 0x1ad515968 +[ABAddressBook sharedAddressBook] + 52
5 Contacts 0x1ad698f88 __62+[CNCDAccessAuthorization requestAccessWithCompletionHandler:]_block_invoke_2 + 184
6 libdispatch.dylib 0x19b876fb4 _dispatch_block_async_invoke2 + 148
7 libdispatch.dylib 0x19b8681b4 _dispatch_client_callout + 20
8 libdispatch.dylib 0x19b879a04 _dispatch_root_queue_drain + 680
9 libdispatch.dylib 0x19b87a104 _dispatch_worker_thread2 + 164
10 libsystem_pthread.dylib 0x19ba28324 _pthread_wqthread + 228
11 libsystem_pthread.dylib 0x19ba27080 start_wqthread + 8
Thread 9:: CVDisplayLink
0 libsystem_kernel.dylib 0x19b9f2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x19ba2c83c _pthread_cond_wait + 1236
2 CoreVideo 0x1a30d6534 CVDisplayLink::runIOThread() + 700
3 libsystem_pthread.dylib 0x19ba2c26c _pthread_start + 148
4 libsystem_pthread.dylib 0x19ba2708c thread_start + 8
Thread 10:: Realm notification listener
0 libsystem_kernel.dylib 0x19b9f4c20 kevent + 8
1 Realm 0x106dd6d98 realm::_impl::ExternalCommitHelper::listen() + 156
2 Realm 0x106dd6ee8 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, realm::_impl::ExternalCommitHelper::ExternalCommitHelper(realm::_impl::RealmCoordinator&)::$_0> >(void*) + 52
3 libsystem_pthread.dylib 0x19ba2c26c _pthread_start + 148
4 libsystem_pthread.dylib 0x19ba2708c thread_start + 8
Thread 11:: Dispatch queue: NSPersistentStoreCoordinator 0x600002495580
0 CoreFoundation 0x19ba801fc CFRelease + 60
1 CoreData 0x1a1b3d9b0 makeBranchRow + 1352
2 CoreData 0x1a1b3d388 -[NSKnownKeysMappingStrategy1 _makeBranchTableForKeys:count:] + 728
3 CoreData 0x1a1b3cea0 -[NSKnownKeysMappingStrategy1 _coreCreationForKeys:count:] + 252
4 CoreData 0x1a1b3cd8c -[NSKnownKeysMappingStrategy1 initForKeys:count:] + 84
5 CoreData 0x1a1b3cc2c +[NSKnownKeysDictionary1 initWithObjects:forKeys:count:] + 72
6 CoreData 0x1a1b4c76c -[NSSQLEntity _generateProperties] + 2132
7 CoreData 0x1a1b4d420 -[NSSQLEntity _generateProperties] + 5384
8 CoreData 0x1a1b4d420 -[NSSQLEntity _generateProperties] + 5384
9 CoreData 0x1a1b4a904 -[NSSQLModel _generateModel:error:] + 1152
10 CoreData 0x1a1b4a428 -[NSSQLModel initWithManagedObjectModel:configurationName:retainHashHack:brokenHashVersion:] + 412
11 CoreData 0x1a1b482c4 -[NSSQLCore initWithPersistentStoreCoordinator:configurationName:URL:options:] + 1016
12 CoreData 0x1a1b46640 __91-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]_block_invoke + 2684
13 CoreData 0x1a1b45860 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 228
14 libdispatch.dylib 0x19b8681b4 _dispatch_client_callout + 20
15 libdispatch.dylib 0x19b877414 _dispatch_lane_barrier_sync_invoke_and_complete + 56
16 CoreData 0x1a1c9a094 _perform + 176
17 CoreData 0x1a1b45364 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 484
18 ContactsPersistence 0x1ad4c396c -[CNPersistentStoreBuilder addInProcessStoreWithURL:options:] + 268
19 ContactsPersistence 0x1ad4c3574 -[CNPersistentStoreBuilder addStoreWithURL:options:] + 128
20 ContactsPersistence 0x1ad4c3278 -[CNPersistentStoreBuilder addPreparedStore] + 336
21 ContactsPersistence 0x1ad4947f4 -[CNPersistentStoreBuilder addPersistentStoreAtURL:] + 48
22 AddressBookCore 0x1ad519b2c -[ABPersistentStoreCoordinatorFactory addStoresForAccounts:withStoreBuilder:] + 284
23 AddressBookCore 0x1ad5194bc -[ABPersistentStoreCoordinatorFactory pool_makeCoordinatorForAllAvailableSources] + 196
24 ContactsFoundation 0x1ad3e6e4c CNResultWithAutoreleasePool + 52
25 AddressBookCore 0x1ad519358 -[ABPersistentStoreCoordinatorFactory makeCoordinatorForAllAvailableSources] + 96
26 AddressBookCore 0x1ad51900c -[ABPersistentStoreCoordinatorMap nts_coordinatorForAllSourcesAndDidUpdateMap:] + 148
27 AddressBookCore 0x1ad518f20 -[ABPersistentStoreCoordinatorCache coordinatorForAllSources] + 48
28 AddressBookCore 0x1ad518c18 -[ABAddressBook(ABAddressBook_CoreData_Private) nts_managedObjectContextWithStoreDescription:databasePath:loadFailure:] + 368
29 AddressBookCore 0x1ad5188f8 -[ABAddressBook(ABAddressBook_CoreData_Private) managedObjectContext] + 152
30 AddressBookCore 0x1ad518764 __38+[ABAddressBook nts_SharedAddressBook]_block_invoke + 44
31 AddressBookCore 0x1ad5186e0 ABRunWithLock + 52
32 AddressBookCore 0x1ad515ef4 +[ABAddressBook nts_SharedAddressBook] + 240
33 AddressBookCore 0x1ad515ccc +[ABAddressBook nts_CreateSharedAddressBook] + 60
34 AddressBookCore 0x1ad515990 +[ABAddressBook sharedAddressBook] + 92
35 ContactsPersistence 0x1ad4923e8 -[CNCDPersistenceStack makePersistenceContext] + 40
36 Contacts 0x1ad671cf8 __72+[CNCDMeContactFetcher allMeContactIdentifiersInPersistenceStack:error:]_block_invoke + 36
37 ContactsFoundation 0x1ad3e6e4c CNResultWithAutoreleasePool + 52
38 Contacts 0x1ad671c10 +[CNCDMeContactFetcher allMeContactIdentifiersInPersistenceStack:error:] + 128
39 Contacts 0x1ad6715e8 __49-[CNDataMapperContactStore meContactIdentifiers:]_block_invoke + 124
40 Contacts 0x1ad67154c __49-[_CNContactsLogger fetchingMeContactIdentifier:]_block_invoke_2 + 44
41 libsystem_trace.dylib 0x19b79d578 os_activity_apply_f + 88
42 Contacts 0x1ad6714d8 -[_CNContactsLogger fetchingMeContactIdentifier:] + 256
43 Contacts 0x1ad6712b8 -[CNDataMapperContactStore meContactIdentifiers:] + 208
44 Contacts 0x1ad6a6740 __48-[CNAggregateContactStore meContactIdentifiers:]_block_invoke + 104
45 ContactsFoundation 0x1ad3f01f4 -[NSArray(ContactsFoundation) _cn_reduce:initialValue:] + 224
46 Contacts 0x1ad6a65f0 -[CNAggregateContactStore meContactIdentifiers:] + 120
47 Contacts 0x1ad67112c -[CNContactStore _unifiedMeContactWithKeysToFetch:error:] + 68
48 CalendarFoundation 0x1b12aa454 __35-[CalContactsProvider _meWithKeys:]_block_invoke + 232
49 libdispatch.dylib 0x19b8681b4 _dispatch_client_callout + 20
50 libdispatch.dylib 0x19b87783c _dispatch_sync_invoke_and_complete_recurse + 64
51 libdispatch.dylib 0x19b8772c8 _dispatch_sync_f_slow + 172
52 CalendarFoundation 0x1b12aa314 -[CalContactsProvider _meWithKeys:] + 192
53 CalendarFoundation 0x1b12aa5f0 -[CalContactsProvider _fetchedUnifiedMeContact] + 196
54 CalendarFoundation 0x1b12a9040 __27-[CalContactsProvider init]_block_invoke.27 + 36
55 libdispatch.dylib 0x19b8665f0 _dispatch_call_block_and_release + 32
56 libdispatch.dylib 0x19b8681b4 _dispatch_client_callout + 20
57 libdispatch.dylib 0x19b86b2c8 _dispatch_queue_override_invoke + 784
58 libdispatch.dylib 0x19b8798e8 _dispatch_root_queue_drain + 396
59 libdispatch.dylib 0x19b87a104 _dispatch_worker_thread2 + 164
60 libsystem_pthread.dylib 0x19ba28324 _pthread_wqthread + 228
61 libsystem_pthread.dylib 0x19ba27080 start_wqthread + 8
Thread 12:
0 libsystem_pthread.dylib 0x19ba27078 start_wqthread + 0
Thread 13:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x19b9ee8b0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x19b9eed20 mach_msg + 76
2 CoreFoundation 0x19baf9210 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x19baf76c0 __CFRunLoopRun + 1180
4 CoreFoundation 0x19baf6a84 CFRunLoopRunSpecific + 600
5 AppKit 0x19e7cb100 _NSEventThread + 196
6 libsystem_pthread.dylib 0x19ba2c26c _pthread_start + 148
7 libsystem_pthread.dylib 0x19ba2708c thread_start + 8
Thread 3 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x000000019b9ea0f5 x5: 0x000000016b80e430 x6: 0x000000000000006e x7: 0x0000000000000001
x8: 0x54fc8dd0d759231d x9: 0x54fc8dd1bcd9d31d x10: 0x0000000000000200 x11: 0x000000000000000b
x12: 0x000000000000000b x13: 0x000000019bf3a2ed x14: 0x000000019b9ea11b x15: 0x0000000000000000
x16: 0x0000000000000148 x17: 0x00000001f5b4f680 x18: 0x0000000000000000 x19: 0x0000000000000006
x20: 0x000000016b80f000 x21: 0x0000000000004207 x22: 0x000000016b80f0e0 x23: 0x000000016b80f0e0
x24: 0x0000000000000000 x25: 0x00006000024f5c68 x26: 0x0000000000000134 x27: 0x0000000000000000
x28: 0x0000600001f7cc40 fp: 0x000000016b80e3a0 lr: 0x000000019ba2bee0
sp: 0x000000016b80e380 pc: 0x000000019b9f6d98 cpsr: 0x40001000
far: 0x000000011d0ac000 esr: 0x56000080 Address size fault
Binary Images:
0x19b9ed000 - 0x19ba24fff libsystem_kernel.dylib (*) <a9d87740-9c1d-3468-bf60-720a8d713cba> /usr/lib/system/libsystem_kernel.dylib
0x19ba25000 - 0x19ba31fff libsystem_pthread.dylib (*) <63c4eef9-69a5-38b1-996e-8d31b66a051d> /usr/lib/system/libsystem_pthread.dylib
0x1ad508000 - 0x1ad66cfff com.apple.AddressBook.core (1.0) <4563eeef-003d-3e34-97a5-8fb39bb8b9e5> /System/Library/PrivateFrameworks/AddressBookCore.framework/Versions/A/AddressBookCore
0x19ba74000 - 0x19bfbafff com.apple.CoreFoundation (6.9) <fc3c193d-0cdb-3569-9f0e-bd2507ca1dbb> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x19c978000 - 0x19cd69fff com.apple.Foundation (6.9) <8bbf8f9b-0034-34f0-a2c5-13c31941632d> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x1ad3de000 - 0x1ad48efff com.apple.AddressBook.ContactsFoundation (8.0) <b3532911-03e0-3b4b-9ef8-2f917c5efd7f> /System/Library/PrivateFrameworks/ContactsFoundation.framework/Versions/A/ContactsFoundation
0x1a4704000 - 0x1a4a37fff com.apple.HIToolbox (2.1.1) <aaf900bd-bfb6-3af0-a8d3-e24bbe1d57f5> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
0x19e61d000 - 0x19f4d5fff com.apple.AppKit (6.9) <5e432f87-5b58-391a-a542-fa2d909dd210> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x1b13b7000 - 0x1b14bdfff com.apple.UIKitMacHelper (1.0) <262cc0ce-2d4d-36cb-add9-bc9b26d56de4> /System/Library/PrivateFrameworks/UIKitMacHelper.framework/Versions/A/UIKitMacHelper
0x1c3b56000 - 0x1c5263fff com.apple.UIKitCore (1.0) <bfeae47b-fbf1-3afe-ad86-95f9b74ed34f> /System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework/Versions/A/UIKitCore
0x104790000 - 0x104e2bfff hyouuu.myapp (6.1.5) <661bc0d3-7b3b-34a1-b28e-8794e0911613> /Applications/MyApp.app/Contents/MacOS/MyApp
0x105104000 - 0x105163fff dyld (*) <38ee9fe9-b66d-3066-8c5c-6ddf0d6944c6> /usr/lib/dyld
0x19b8ec000 - 0x19b96dfff libsystem_c.dylib (*) <b25d2080-bb9e-38d6-8236-9cef4b2f11a3> /usr/lib/system/libsystem_c.dylib
0x19b9d5000 - 0x19b9ecfff libc++abi.dylib (*) <4e8d8a11-4217-3d56-9d41-5426f7cf307c> /usr/lib/libc++abi.dylib
0x19b8ab000 - 0x19b8e8fff libobjc.A.dylib (*) <ec96f0fa-6341-3e1d-be54-49b544e17f7d> /usr/lib/libobjc.A.dylib
0x19b864000 - 0x19b8aafff libdispatch.dylib (*) <b3c7a004-1069-3171-b630-2c386a8b399c> /usr/lib/system/libdispatch.dylib
0x1ad66d000 - 0x1ad7e6fff com.apple.contacts (1.0) <b983b43b-8fd0-3436-964f-4fe7e3620da4> /System/Library/Frameworks/Contacts.framework/Versions/A/Contacts
0x1a30d4000 - 0x1a3131fff com.apple.CoreVideo (1.8) <5ae3672a-4b9a-3ef6-b310-a2d980d6ca0e> /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo
0x106a30000 - 0x106fcffff io.Realm.Realm (6.1.5) <40de4a56-6ed8-3190-9ee3-dc993f9a07d3> /Applications/MyApp.app/Contents/Frameworks/Realm.framework/Versions/A/Realm
0x1a1b34000 - 0x1a1f09fff com.apple.CoreData (120) <9336f822-02b3-3bc2-8974-b675213aef76> /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
0x1ad48f000 - 0x1ad507fff com.apple.contacts.ContactsPersistence (1.0) <6b19352a-945e-3eaf-9e34-32d3d2e24321> /System/Library/PrivateFrameworks/ContactsPersistence.framework/Versions/A/ContactsPersistence
0x19b795000 - 0x19b7aefff libsystem_trace.dylib (*) <b5524014-1a7f-3d07-8855-5e75a55e4a11> /usr/lib/system/libsystem_trace.dylib
0x1b1270000 - 0x1b12f7fff com.apple.CalendarFoundation (8.0) <bdd10f22-1466-39df-925d-f9bd19916ccc> /System/Library/PrivateFrameworks/CalendarFoundation.framework/Versions/A/CalendarFoundation
0x1055dc000 - 0x1056abfff io.realm.RealmSwit (6.1.5) <7600ce20-ca0d-32a7-98ff-41cfd27d8d1b> /Applications/MyApp.app/Contents/Frameworks/RealmSwift.framework/Versions/A/RealmSwift
0x1b064a000 - 0x1b064cfff libswiftObjectiveC.dylib (*) <26a1bf11-c23f-3aab-aad0-0b83471709e6> /usr/lib/swift/libswiftObjectiveC.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 17
thread_create: 0
thread_set_state: 1200
VM Region Summary:
ReadOnly portion of Libraries: Total=1.2G resident=0K(0%) swapped_out_or_unallocated=1.2G(100%)
Writable regions: Total=1.8G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.8G(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 128K 1
Activity Tracing 256K 1
CG backing stores 2880K 4
CG image 48K 1
CG raster data 1632K 28
ColorSync 256K 9
CoreAnimation 9520K 113
CoreData 400K 2
CoreData Object IDs 4112K 2
CoreGraphics 16K 1
CoreUI image data 976K 6
Foundation 48K 2
Image IO 16K 1
Kernel Alloc Once 32K 1
MALLOC 375.4M 103
MALLOC guard page 576K 27
MALLOC_MEDIUM (reserved) 1.1G 9 reserved VM address space (unallocated)
MALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)
SQLite page cache 128K 2
STACK GUARD 56.2M 14
Stack 14.9M 14
VM_ALLOCATE 208K 6
__AUTH 3986K 492
__AUTH_CONST 26.5M 711
__CTF 756 1
__DATA 20.7M 727
__DATA_CONST 27.8M 745
__DATA_DIRTY 2966K 323
__FONT_DATA 4K 1
__LINKEDIT 583.5M 30
__OBJC_CONST 6326K 458
__OBJC_RO 83.0M 1
__OBJC_RW 3168K 1
__TEXT 646.1M 761
__UNICODE 592K 1
dyld private memory 1024K 1
mapped file 617.7M 41
shared memory 976K 18
=========== ======= =======
TOTAL 3.9G 4660
TOTAL, minus reserved VM space 2.4G 4660
Can you reproduce the bug?
Yes, always
Reproduction Steps
I can only reproduce in the current app not in a separate project.
Version
10.29
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
macOS 12.6 (21G115)
Build environment
Xcode version: 13.3 (likely) Dependency manager and version: XCFramework from Carthage download
I don't think this is related to Realm from looking at this crash dump. Have you tried removing the code using AddressBookCore and CoreData to try single out the issue?
@leemaguire thanks for the quick reply, but I don't use either of those libraries and think they're just other unrelated system threads
Weird, what dependancies do you use in your app? It's likely something else is using those frameworks.
What made you think it's the CoreData that caused the crash? The backtrace seems to suggest Realm no?

Can you show the usage of Realm up to the point where that exception is thrown? Usually if its a fatal crash with Realm you will receive a full back trace.
I only have it from the App Store version so unfortunately couldn't get that info. However, looking more in to the above stack trace the it looks like a NSString exception which made I remember this issue: https://github.com/realm/realm-swift/issues/4573 Might be somehow generated corrupted string with invalid char? There has been no response to the other tickets and wonder could we prioritize it? It has been my top crash for quite a while. Attaching the stack trace in the next comment
Fatal Exception: RLMException
0 CoreFoundation 0x99d78 __exceptionPreprocess
1 libobjc.A.dylib 0x16734 objc_exception_throw
2 Realm 0xaedc (Missing UUID 7affe0fd913d36dfaf6b9de8508f309d)
3 Realm 0x62c60 (Missing UUID 7affe0fd913d36dfaf6b9de8508f309d)
4 Pendo 0x30db98 closure #1 in closure #1 in rlmAdd(:obj:touchUpdate:overrideUpdate:isFromSyncer:checkNoteHasMedia:) (
cc @leemaguire and thanks again for taking care of this!
Any updates? @leemaguire
Ok got a stack trace in debug environment:
*** Terminating app due to uncaught exception 'RLMException', reason: 'No object with key '14135' in 'class_NoteR''
*** First throw call stack:
(
0 CoreFoundation 0x000000019bb79148 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x000000019b8c3e04 objc_exception_throw + 60
2 Realm 0x00000001046faef0 _Z20RLMThrowResultsErrorP8NSString + 436
3 Realm 0x00000001046fb2f0 -[RLMResults countByEnumeratingWithState:objects:count:] + 116
4 Realm 0x00000001045eee8c RLMDescriptionWithMaxDepth + 252
5 RealmSwift 0x0000000102dfeef8 $s10RealmSwift7ResultsV11descriptionSSvg + 68
6 libswiftCore.dylib 0x00000001a8c00458 $ss26DefaultStringInterpolationV06appendC0yyxs06CustomB11ConvertibleRzlF + 56
7 myapp 0x000000010064c514 $s5myapp9NotesUtilC25doUpdateUpcomingCalEventsyyFZyyXEfU_SSyXEfu_ + 172
8 myapp 0x0000000100671c58 $s5myapp2pr_4file4line8functionySSyXK_SSSiSStF + 152
9 myapp 0x000000010064b548 $s5myapp9NotesUtilC25doUpdateUpcomingCalEventsyyFZyyXEfU_ + 1024
10 myapp 0x000000010064c45c $s5myapp9NotesUtilC25doUpdateUpcomingCalEventsyyFZyyXEfU_TA + 24
11 libswiftObjectiveC.dylib 0x00000001b064bad4 $s10ObjectiveC15autoreleasepool8invokingxxyKXE_tKlF + 64
12 myapp 0x000000010064b128 $s5myapp9NotesUtilC25doUpdateUpcomingCalEventsyyFZ + 76
13 myapp 0x000000010064b09c $s5myapp9NotesUtilC25bgUpdateUpcomingCalEventsyyFZyycfU_ + 36
14 myapp 0x000000010067db64 $s5myapp5delay_5queue5blockyycSgSd_So012OS_dispatch_C0CyyctFyycfU0_ + 136
15 myapp 0x000000010067c2ec $sIeg_IeyB_TR + 48
16 libdispatch.dylib 0x00000001027d63a8 _dispatch_client_callout + 20
17 libdispatch.dylib 0x00000001027d9ca8 _dispatch_continuation_pop + 812
18 libdispatch.dylib 0x00000001027f4c78 _dispatch_source_invoke + 1740
19 libdispatch.dylib 0x00000001027df51c _dispatch_lane_serial_drain + 376
20 libdispatch.dylib 0x00000001027e0814 _dispatch_lane_invoke + 492
21 libdispatch.dylib 0x00000001027f00c8 _dispatch_workloop_worker_thread + 1232
22 libsystem_pthread.dylib 0x0000000102327f84 _pthread_wqthread + 288
23 libsystem_pthread.dylib 0x000000010232fa9c start_wqthread + 8
)
It happens when I try to access events.count after:
let events = try Realm().objects(NoteR.self)
.filter(NSPredicate(format: "endDate >= %@ AND type = 'calendar'", NSDate(timeIntervalSinceNow: -60)))
.sorted(by: [
SortDescriptor(keyPath: "date", ascending: true),
SortDescriptor(keyPath: "title", ascending: false),
SortDescriptor(keyPath: "text", ascending: false)
])
Removing the .filter line makes the crash go away, so I suspect there's a regression with NSPredicate filtering, maybe when where was introduced around 10.19?
Okay the source of the issue is somehow the data got corrupted it seems - I got realm objects with primary key id == (null)
which should never happen as id is a String type and always assigned a String on init. Is there any way to fix such corrupted database?
@jedelbo @nicola-cab I don't see anything in this issue that's directed to the ArrayBigBlobs you've been looking at. But this is noteworthy. Wondering if you have anything thoughts.
@ericjordanmossman it seems you commented on the wrong issue - the link is to this issue so I assume you were trying to comment elsewhere? Either way would be great to get some insights on this issue as I'm preparing to move away from Realm if this doesn't get resolved :(
@hyouuu I at'ed the others because they have been working on an unrelated possible corruption issue. The fact that a primary key id was null is very noteworthy and I wondered if they had insight.
Probably fixed by https://github.com/realm/realm-core/pull/5993
Great to hear - are we making a realm-swift release soon with the fix? I should be able to verify right away as the crash is happening on my macOS app right now @jedelbo @ericjordanmossman
@hyouuu please be aware that the fix cannot fix an already corrupted file, but will hopefully prevent future corruptions. From where did you get the file that currently makes your app crash on macOS?
Oops @jedelbo is there any way to recover or delete the corrupted entities to make a corrupted state work again? If not possible, is there any way to handle the corruption so I can maybe clear out the entire realm on disk and re-generate from my other sources? Currently there doesn't seem to be a way to fix the state at all.
I was generating new entities from calendar events on macOS, and I'm not using any Realm Sync features
In theory it would be possible to export that parts of the database that can still be reached, but we have not yet implemented such an option. The best way to start from fresh is to delete the broken file and create a new.
@jedelbo is there a way to detect a corruption without crashing the app?
@hyouuu we currently don't expose such an API.