Crash when accessing Core Data because file couldn't be opened

We have a crash regarding to Core Data access that was not reproducible in our side but the crash count keeps increasing with the last stack trace is assertionFailure from Apple internal SDK.

The last stack trace before the assertionFailure by system is our code initializing CoreData in DataContainer.init(name:bundle:inMemory:) where we will try to access CoreData and the error message we found from our 3rd party crash reporter is something like this DataStore/DataContainer.swift:30: Fatal error: Unresolved error Error Domain=NSCocoaErrorDomain Code=256 "The file “Content.sqlite” couldn’t be opened. UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9DBF262C-851A-486B-90CC-4397A8896525/Library/Application Support/Content.sqlite, NSSQLiteErrorDomain=13}, ["NSSQLiteErrorDomain": 13, "NSFilePath": /var/mobile/Containers/Data/Application/9DBF262C-851A-486B-90CC-4397A8896525/Library/Application Support/Content.sqlite]

That sqlite file is supposed to be file used by Core Data (since we have no other code that access it) and we are quite confused on why sometimes the CoreData cannot be accessed with that kind of error message. So far, we still have no idea to reproduce it and what do to resolve it.

I have submitted the report with bug number: FB14433998

I attached an example of the crash report here too. Please gave us insight on why it happened and how we can prevent it from happening again.

Incident Identifier: 59322391-062F-4840-8010-F7E35E6610A9
Hardware Model:      iPhone12,1
Process:             example [1856]
Path:                /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/example
Identifier:          com.kmk.example
Version:             6.32.0 (2163)
AppStoreTools:       15F31e
AppVariant:          1:iPhone12,1:15
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.kmk.example [565]

Date/Time:           2024-07-21 16:21:50.6681 +0700
Launch Time:         2024-07-21 03:39:50.2938 +0700
OS Version:          iPhone OS 16.3 (20D47)
Release Type:        User
Baseband Version:    4.00.00
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000018e4a9d7c
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [1856]

Triggered by Thread:  0


Thread 0 name:
Thread 0 Crashed:
0   libswiftCore.dylib            	0x000000018e4a9d7c _assertionFailure(_:_:file:line:flags:) + 312 (AssertCommon.swift:143)
1   DataStore_171A8F8EE36AD090_PackageProduct	0x00000001059d477c closure #1 in DataContainer.init(name:bundle:inMemory:) + 376 (DataContainer.swift:30)
2   DataStore_171A8F8EE36AD090_PackageProduct	0x00000001059d47d0 thunk for @escaping @callee_guaranteed (@guaranteed NSPersistentStoreDescription, @guaranteed Error?) -> () + 80 (:0)
3   CoreData                      	0x000000019bf1b8ac -[NSPersistentStoreCoordinator _doAddPersistentStoreWithDescription:privateCopy:completeOnMainThread:withHandler:] + 668 (NSPersistentStoreCoordinator.m:1366)
4   CoreData                      	0x000000019bf7f234 -[NSPersistentStoreCoordinator addPersistentStoreWithDescription:completionHandler:] + 228 (NSPersistentStoreCoordinator.m:1412)
5   CoreData                      	0x000000019bf7eff0 -[NSPersistentContainer _loadStoreDescriptions:withCompletionHandler:] + 184 (NSPersistentContainer.m:291)
6   CoreData                      	0x000000019bf7eefc -[NSPersistentContainer loadPersistentStoresWithCompletionHandler:] + 248 (NSPersistentContainer.m:274)
7   DataStore_171A8F8EE36AD090_PackageProduct	0x00000001059d4380 DataContainer.init(name:bundle:inMemory:) + 476 (DataContainer.swift:28)
8   Content                       	0x00000001061c28f4 DataContainer.__allocating_init(name:bundle:inMemory:) + 60 (:0)
9   Content                       	0x00000001061c28f4 closure #1 in ContentContainer.contentDataContainer.getter + 132
10  Content                       	0x00000001061c28f4 0x1061a0000 + 141556 (WatchHistoryFactory.swift:46)
11  SharedDependencies            	0x0000000106ada6b0 thunk for @escaping @callee_guaranteed () -> (@out A) + 4 (:0)
12  SharedDependencies            	0x0000000106ada6b0 partial apply for thunk for @escaping @callee_guaranteed () -> (@out A) + 20
13  SharedDependencies            	0x0000000106ae27d8 closure #1 in FactoryRegistration.resolve(with:) + 8 (Registrations.swift:113)
14  SharedDependencies            	0x0000000106ae27d8 partial apply for closure #1 in FactoryRegistration.resolve(with:) + 24 (:0)
15  SharedDependencies            	0x0000000106ae32e0 Scope.resolve<a>(using:key:ttl:factory:) + 412 (Scopes.swift:69)
16  SharedDependencies            	0x0000000106ae45a4 Scope.Graph.resolve</a><a>(using:key:ttl:factory:) + 120
17  SharedDependencies            	0x0000000106ae4520 Scope.Singleton.resolve</a><a>(using:key:ttl:factory:) + 36
18  SharedDependencies            	0x0000000106adf9c0 FactoryRegistration.resolve(with:) + 1224 (Registrations.swift:113)
19  SharedDependencies            	0x0000000106ad9de4 Factory.callAsFunction() + 84
20  Content                       	0x00000001061c2834 closure #1 in closure #1 in ContentContainer.watchHistoryCoreDataStore.getter + 212 (WatchHistoryFactory.swift:40)
21  Content                       	0x00000001061c261c implicit closure #4 in implicit closure #3 in closure #1 in ContentContainer.watchedVideoStore.getter + 40
22  Content                       	0x00000001061c29c0 partial apply for implicit closure #4 in implicit closure #3 in closure #1 in ContentContainer.watchedVideoStore.getter + 28 (:0)
23  Content                       	0x00000001061da21c specialized WatchedVideoStore.watchedVideos.getter + 324 (WatchedVideoStore.swift:33)
24  example                         	0x0000000104337674 closure #1 in closure #1 in closure #1 in Container.continueWatching.getter + 132 (ContinueWatchingFactory.swift:16)
25  Combine                       	0x000000019ced4178 Deferred.receive</a><a>(subscriber:) + 168 (Deferred.swift:25)
26  Combine                       	0x000000019ceda3ac PublisherBox.receive</a><a>(subscriber:) + 108 (AnyPublisher.swift:38)
27  Combine                       	0x000000019ceb708c AnyPublisher.receive</a><a>(subscriber:) + 64 (AnyPublisher.swift:80)
28  Combine                       	0x000000019cecdbe8 Publishers.Map.receive</a><a>(subscriber:) + 572 (Map.swift:94)
29  Combine                       	0x000000019ceda3ac PublisherBox.receive</a><a>(subscriber:) + 108 (AnyPublisher.swift:38)
30  Combine                       	0x000000019ceb708c AnyPublisher.receive</a><a>(subscriber:) + 64 (AnyPublisher.swift:80)
31  Combine                       	0x000000019cecdbe8 Publishers.Map.receive</a><a>(subscriber:) + 572 (Map.swift:94)
32  Combine                       	0x000000019ced9e10 Publishers.FlatMap.receive</a><a>(subscriber:) + 416 (FlatMap.swift:123)
33  Combine                       	0x000000019cedd700 Publishers.HandleEvents.receive</a><a>(subscriber:) + 620 (Events.swift:114)
34  Combine                       	0x000000019ceda3ac PublisherBox.receive</a><a>(subscriber:) + 108 (AnyPublisher.swift:38)
35  Combine                       	0x000000019ceb708c AnyPublisher.receive</a><a>(subscriber:) + 64 (AnyPublisher.swift:80)
36  Combine                       	0x000000019cecdbe8 Publishers.Map.receive</a><a>(subscriber:) + 572 (Map.swift:94)
37  Combine                       	0x000000019cef4580 Publisher.sink(receiveCompletion:receiveValue:) + 368 (Sink.swift:39)
38  example                         	0x0000000104218184 DeferredSectionViewModel.onFirstAppeared() + 512 (DeferredSectionViewModel.swift:67)
39  example                         	0x000000010439d008 DeferredSectionView.onFirstAppeared() + 28 (DeferredSectionView.swift:73)
40  example                         	0x000000010426e91c closure #3 in FluidSectionStackViewLayout.observeVisible(section:) + 68 (FluidSectionStackViewLayout.swift:210)
41  example                         	0x000000010426f458 thunk for @escaping @callee_guaranteed (@unowned Action #1 in FluidSectionStackViewLayout.observeVisible(section:)) -> () + 8 (:0)
42  example                         	0x000000010426f458 partial apply for thunk for @escaping @callee_guaranteed (@unowned Action #1 in FluidSectionStackViewLayout.observeVisible(section:)) -> () + 24
43  RxSwift                       	0x00000001087cc270 closure #1 in ObservableType.subscribe(onNext:onError:onCompleted:onDisposed:) + 272 (ObservableType+Extensions.swift:109)
44  RxSwift                       	0x00000001087cc440 partial apply for closure #1 in ObservableType.subscribe(onNext:onError:onCompleted:onDisposed:) + 48 (:0)
45  RxSwift                       	0x00000001087e41a0 AnonymousObserver.onCore(_:) + 20 (AnonymousObserver.swift:22)
46  RxSwift                       	0x00000001087cdabc ObserverBase.on(_:) + 276 (ObserverBase.swift:16)
47  RxSwift                       	0x00000001087cdc74 protocol witness for ObserverType.on(_:) in conformance ObserverBase</a><a> + 20 (:0)
48  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
49  RxSwift                       	0x00000001087a6ec8 DistinctUntilChangedSink.on(_:) + 812 (DistinctUntilChanged.swift:105)
50  RxSwift                       	0x00000001087a70d0 protocol witness for ObserverType.on(_:) in conformance DistinctUntilChangedSink + 20 (:0)
51  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
52  RxSwift                       	0x00000001087d0098 SkipWhileSink.on(_:) + 312 (SkipWhile.swift:62)
53  RxSwift                       	0x00000001087d0248 protocol witness for ObserverType.on(_:) in conformance SkipWhileSink</a><a> + 20 (:0)
54  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
55  RxSwift                       	0x00000001087af9fc SwitchSinkIter.synchronized_on(_:) + 340 (Switch.swift:177)
56  RxSwift                       	0x00000001087dd914 SynchronizedOnType.synchronizedOn(_:) + 92 (SynchronizedOnType.swift:16)
57  RxSwift                       	0x00000001087afae4 protocol witness for ObserverType.on(_:) in conformance SwitchSinkIter + 20 (:0)
58  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
59  RxSwift                       	0x000000010881cfc4 MapSink.on(_:) + 632 (Map.swift:44)
60  RxSwift                       	0x000000010881d0d4 protocol witness for ObserverType.on(_:) in conformance MapSink + 20 (:0)
61  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
62  RxSwift                       	0x00000001087a6ec8 DistinctUntilChangedSink.on(_:) + 812 (DistinctUntilChanged.swift:105)
63  RxSwift                       	0x00000001087a70d0 protocol witness for ObserverType.on(_:) in conformance DistinctUntilChangedSink + 20 (:0)
64  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
65  RxSwift                       	0x00000001087c2358 CombineLatestSink.next(_:) + 624 (CombineLatest.swift:49)
66  RxSwift                       	0x00000001087c29ac CombineLatestObserver.synchronized_on(_:) + 384 (CombineLatest.swift:0)
67  RxSwift                       	0x00000001087dd914 SynchronizedOnType.synchronizedOn(_:) + 92 (SynchronizedOnType.swift:16)
68  RxSwift                       	0x00000001087c2a24 protocol witness for ObserverType.on(_:) in conformance CombineLatestObserver</a><a> + 20 (:0)
69  RxSwift                       	0x00000001088244c8 implicit closure #2 in implicit closure #1 in closure #1 in ShareWhileConnectedConnection.synchronized_subscribe</a><a>(_:) + 8 (ShareReplayScope.swift:354)
70  RxSwift                       	0x00000001088244c8 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in ShareWhileConnectedConnection.synchronized_subscribe</a><a>(_:) + 44 (:0)
71  RxSwift                       	0x0000000108824438 thunk for @escaping @callee_guaranteed (@in_guaranteed Event</a><a>) -> () + 4 (:0)
72  RxSwift                       	0x0000000108824438 partial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed Event</a><a>) -> () + 20
73  RxSwift                       	0x0000000108823308 ShareReplay1WhileConnectedConnection.on(_:) + 124
74  RxSwift                       	0x0000000108822eac protocol witness for ObserverType.on(_:) in conformance ShareReplay1WhileConnectedConnection</a><a> + 28 (:0)
75  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
76  RxSwift                       	0x00000001087a6ec8 DistinctUntilChangedSink.on(_:) + 812 (DistinctUntilChanged.swift:105)
77  RxSwift                       	0x00000001087a70d0 protocol witness for ObserverType.on(_:) in conformance DistinctUntilChangedSink + 20 (:0)
78  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
79  RxSwift                       	0x00000001087b14c8 TakeUntilSink.synchronized_on(_:) + 180 (TakeWithPredicate.swift:181)
80  RxSwift                       	0x00000001087dd914 SynchronizedOnType.synchronizedOn(_:) + 92 (SynchronizedOnType.swift:16)
81  RxSwift                       	0x00000001087b1820 protocol witness for ObserverType.on(_:) in conformance TakeUntilSink + 28 (:0)
82  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
83  RxSwift                       	0x00000001087efc14 closure #1 in MergeSinkIter.on(_:) + 352 (Merge.swift:394)
84  RxSwift                       	0x00000001087efa8c thunk for @callee_guaranteed () -> () + 12 (:0)
85  RxSwift                       	0x00000001087efa8c specialized NSRecursiveLock.performLocked</a><a>(_:) + 24 (Lock.swift:21)
86  RxSwift                       	0x00000001087efa8c MergeSinkIter.on(_:) + 84 (Merge.swift:391)
87  RxSwift                       	0x00000001087efd94 protocol witness for ObserverType.on(_:) in conformance MergeSinkIter + 20 (:0)
88  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
89  RxSwift                       	0x000000010881cfc4 MapSink.on(_:) + 632 (Map.swift:44)
90  RxSwift                       	0x000000010881d0d4 protocol witness for ObserverType.on(_:) in conformance MapSink + 20 (:0)
91  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
92  RxSwift                       	0x000000010881cfc4 MapSink.on(_:) + 632 (Map.swift:44)
93  RxSwift                       	0x000000010881d0d4 protocol witness for ObserverType.on(_:) in conformance MapSink + 20 (:0)
94  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
95  RxSwift                       	0x00000001087a1ed8 FilterSink.on(_:) + 420 (Filter.swift:56)
96  RxSwift                       	0x00000001087a1fe0 protocol witness for ObserverType.on(_:) in conformance FilterSink</a><a> + 20 (:0)
97  RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
98  RxSwift                       	0x00000001087a6ec8 DistinctUntilChangedSink.on(_:) + 812 (DistinctUntilChanged.swift:105)
99  RxSwift                       	0x00000001087a70d0 protocol witness for ObserverType.on(_:) in conformance DistinctUntilChangedSink + 20 (:0)
100 RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
101 RxSwift                       	0x000000010881cfc4 MapSink.on(_:) + 632 (Map.swift:44)
102 RxSwift                       	0x000000010881d0d4 protocol witness for ObserverType.on(_:) in conformance MapSink + 20 (:0)
103 RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
104 RxSwift                       	0x000000010881cfc4 MapSink.on(_:) + 632 (Map.swift:44)
105 RxSwift                       	0x000000010881d0d4 protocol witness for ObserverType.on(_:) in conformance MapSink + 20 (:0)
106 RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
107 RxSwift                       	0x00000001088278ac ThrottleSink.sendNow(element:) + 360 (Throttle.swift:120)
108 RxSwift                       	0x0000000108827694 ThrottleSink.synchronized_on(_:) + 1944 (Throttle.swift:81)
109 RxSwift                       	0x00000001087dd914 SynchronizedOnType.synchronizedOn(_:) + 92 (SynchronizedOnType.swift:16)
110 RxSwift                       	0x0000000108827dac protocol witness for ObserverType.on(_:) in conformance ThrottleSink</a><a> + 20 (:0)
111 RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
112 RxSwift                       	0x00000001087c2358 CombineLatestSink.next(_:) + 624 (CombineLatest.swift:49)
113 RxSwift                       	0x00000001087c29ac CombineLatestObserver.synchronized_on(_:) + 384 (CombineLatest.swift:0)
114 RxSwift                       	0x00000001087dd914 SynchronizedOnType.synchronizedOn(_:) + 92 (SynchronizedOnType.swift:16)
115 RxSwift                       	0x00000001087c2a24 protocol witness for ObserverType.on(_:) in conformance CombineLatestObserver</a><a> + 20 (:0)
116 RxSwift                       	0x00000001087e373c Sink.forwardOn(_:) + 112 (Sink.swift:34)
117 RxSwift                       	0x00000001088023d0 SubscribeOnSink.on(_:) + 32 (SubscribeOn.swift:64)
118 RxSwift                       	0x0000000108802884 protocol witness for ObserverType.on(_:) in conformance SubscribeOnSink + 20 (:0)
119 RxSwift                       	0x00000001088099e4 implicit closure #2 in implicit closure #1 in BehaviorSubject.synchronized_subscribe</a><a>(_:) + 8 (BehaviorSubject.swift:120)
120 RxSwift                       	0x00000001088099e4 partial apply for implicit closure #2 in implicit closure #1 in BehaviorSubject.synchronized_subscribe</a><a>(_:) + 44 (:0)
121 RxSwift                       	0x000000010882212c thunk for @escaping @callee_guaranteed (@in_guaranteed Event</a><a>) -> () + 20 (:0)
122 RxSwift                       	0x00000001088087ac thunk for @escaping @callee_guaranteed (@in_guaranteed Event</a><a>) -> (@out ()) + 8 (:0)
123 RxSwift                       	0x00000001088087ac dispatch</a><a>(_:_:) + 152 (Bag+Rx.swift:22)
124 RxSwift                       	0x00000001088087ac BehaviorSubject.on(_:) + 240 (BehaviorSubject.swift:82)
125 RxCocoa                       	0x0000000105d33994 RxScrollViewDelegateProxy.scrollViewDidScroll(_:) + 88 (RxScrollViewDelegateProxy.swift:82)
126 RxCocoa                       	0x0000000105d33a74 @objc RxScrollViewDelegateProxy.scrollViewDidScroll(_:) + 52 (:0)
127 UIKitCore                     	0x0000000196976af4 -[UIScrollView _notifyDidScroll] + 72 (UIScrollView.m:11668)
128 UIKitCore                     	0x00000001968c2e10 -[UIScrollView setContentOffset:] + 1032 (UIScrollView.m:2797)
129 Foundation                    	0x000000018ea4d534 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604 (NSKeyValueObserving.m:2650)
130 Foundation                    	0x000000018ea4d2b0 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64 (NSKeyValueObserving.m:2676)
131 Foundation                    	0x000000018ea4d234 _NSSetPointValueAndNotify + 300 (NSKeyValueObserverNotifying.m:107)
132 UIKitCore                     	0x000000019692daec -[UIScrollView _smoothScrollSyncWithUpdateTime:] + 2160 (UIScrollView.m:9023)
133 UIKitCore                     	0x000000019692d22c -[UIScrollView _smoothScrollWithUpdateTime:] + 244 (UIScrollView.m:8810)
134 UIKitCore                     	0x0000000196bfbd38 -[UIScrollView _smoothScrollDisplayLink:] + 480 (UIScrollView.m:9176)
135 QuartzCore                    	0x0000000195d66ca4 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 820 (CADisplay.mm:4507)
136 QuartzCore                    	0x0000000195d786f8 display_timer_callback(__CFMachPort*, void*, long, void*) + 372 (CADisplayTimer.cpp:219)
137 CoreFoundation                	0x00000001947167f4 __CFMachPortPerform + 176 (CFMachPort.c:586)
138 CoreFoundation                	0x0000000194733cd0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60 (CFRunLoop.c:1981)
139 CoreFoundation                	0x00000001947358d8 __CFRunLoopDoSource1 + 520 (CFRunLoop.c:2120)
140 CoreFoundation                	0x0000000194717110 __CFRunLoopRun + 2264 (CFRunLoop.c:3175)
141 CoreFoundation                	0x000000019471beb0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
142 GraphicsServices              	0x00000001ce911368 GSEventRunModal + 164 (GSEvent.c:2196)
143 UIKitCore                     	0x0000000196c11668 -[UIApplication _run] + 888 (UIApplication.m:3758)
144 UIKitCore                     	0x0000000196c112cc UIApplicationMain + 340 (UIApplication.m:5348)
145 example                         	0x00000001041b8090 main + 144 (main.swift:12)
146 dyld                          	0x00000001b3014960 start + 2528 (dyldMain.cpp:1170)

Thread 1 name:
Thread 1:
0   libsystem_kernel.dylib        	0x00000001d21b967c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001e292406c _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001a2d59b68 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock&, std::__1::chrono::time_point::Run::GCSchedulerDataWithTimer(kotlin::gc::GCSchedulerConfig&, std::__1::functi... + 260
4   ExampleLib                      	0x000000010a557280 void* std::__1::__thread_proxy>, void (*)(kotlin::ScopedThread::attributes, void ... + 112
5   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 2 name:
Thread 2:
0   libsystem_kernel.dylib        	0x00000001d21b967c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001e292406c _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001a2d59acc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:380)
3   ExampleLib                      	0x000000010a55b304 std::__1::invoke_result&, kotlin::gc::GCScheduler&)::$_3>::type kotlin::Scop... + 268
4   ExampleLib                      	0x000000010a55c4bc void* std::__1::__thread_proxy>, void (*)(kotlin::ScopedThread::attributes, kotli... + 104
5   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 3:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 4:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib        	0x00000001d21b908c mach_absolute_time + 44
1   QuartzCore                    	0x0000000195d830d4 CACurrentMediaTime + 16 (CATime.cpp:50)
2   UIKitCore                     	0x0000000196a46984 -[UIEventFetcher _receiveHIDEventInternal:] + 876 (UIEventFetcher.m:2052)
3   IOKit                         	0x000000019c64784c __IOHIDEventSystemClientQueueCallback + 328 (IOHIDEventSystemClient.c:1341)
4   CoreFoundation                	0x00000001947167f4 __CFMachPortPerform + 176 (CFMachPort.c:586)
5   CoreFoundation                	0x0000000194733cd0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 60 (CFRunLoop.c:1981)
6   CoreFoundation                	0x00000001947358d8 __CFRunLoopDoSource1 + 520 (CFRunLoop.c:2120)
7   CoreFoundation                	0x0000000194717110 __CFRunLoopRun + 2264 (CFRunLoop.c:3175)
8   CoreFoundation                	0x000000019471beb0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
9   Foundation                    	0x000000018ea50054 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
10  Foundation                    	0x000000018ea4ff3c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
11  UIKitCore                     	0x0000000196d466a4 -[UIEventFetcher threadMain] + 436 (UIEventFetcher.m:1385)
12  Foundation                    	0x000000018ea69518 __NSThread__start__ + 716 (NSThread.m:963)
13  libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
14  libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 6:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 7:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 8:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 9:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 10 name:
Thread 10:
0   libsystem_platform.dylib      	0x00000001e2886e74 _platform_strlen + 52
1   example                         	0x0000000104c06670 FIRCLSSDKFileLog + 172
2   example                         	0x0000000104c082dc FIRCLSMachExceptionServer + 968
3   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
4   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 11:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 12:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 13 name:
Thread 13:
0   libsystem_kernel.dylib        	0x00000001d21b967c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001e292406c _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   JavaScriptCore                	0x00000001a7e73114 scavenger_thread_main + 1364 (pas_scavenger.c:145)
3   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
4   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 14:
0   libsystem_kernel.dylib        	0x00000001d21b967c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001e292406c _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   ExampleLib                      	0x000000010a576564 (anonymous namespace)::waitInNativeState(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 108
3   ExampleLib                      	0x000000010a575524 Worker::processQueueElement(bool) + 752
4   ExampleLib                      	0x000000010a5751a4 (anonymous namespace)::workerRoutine(void*) + 108
5   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 15 name:
Thread 15:
0   libsystem_kernel.dylib        	0x00000001d21b8da8 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001d21cba1c mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001d21cbc5c mach_msg_overwrite + 388 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001d21b92ec mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x0000000194715ac4 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x0000000194716d08 __CFRunLoopRun + 1232 (CFRunLoop.c:3005)
6   CoreFoundation                	0x000000019471beb0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   CFNetwork                     	0x0000000195a86ff0 +[__CFN_CoreSchedulingSetRunnable _run:] + 392 (CoreSchedulingSet.mm:1372)
8   Foundation                    	0x000000018ea69518 __NSThread__start__ + 716 (NSThread.m:963)
9   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
10  libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 16 name:
Thread 16:
0   libsystem_kernel.dylib        	0x00000001d21b967c __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x00000001e292406c _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001a2d59acc std::__1::condition_variable::wait(std::__1::unique_lock&) + 28 (__threading_support:380)
3   ExampleLib                      	0x000000010a55c718 std::__1::invoke_result::type kotlin::ScopedThread::Run(kotlin:... + 212
4   ExampleLib                      	0x000000010a55c9b4 void* std::__1::__thread_proxy>, void (*)(kotlin::ScopedThread::attributes, kotli... + 104
5   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 17:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 18:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 19:
0   libsystem_pthread.dylib       	0x00000001e291cb90 start_wqthread + 0 (:-1)

Thread 20:
0   libsystem_kernel.dylib        	0x00000001d21b8da8 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001d21cba1c mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001d21cbc5c mach_msg_overwrite + 388 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001d21b92ec mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x0000000194715ac4 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x0000000194716d08 __CFRunLoopRun + 1232 (CFRunLoop.c:3005)
6   CoreFoundation                	0x000000019471beb0 CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   Foundation                    	0x000000018ea50054 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   GoogleCast                    	0x000000010648292c -[GCKBackgroundThread main] + 192 (:-1)
9   Foundation                    	0x000000018ea69518 __NSThread__start__ + 716 (NSThread.m:963)
10  libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
11  libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)

Thread 21 name:
Thread 21:
0   libsystem_kernel.dylib        	0x00000001d21b990c select$DARWIN_EXTSN + 8 (:-1)
1   CoreFoundation                	0x0000000194766694 __CFSocketManager + 636 (CFSocket.c:1340)
2   libsystem_pthread.dylib       	0x00000001e291d6cc _pthread_start + 148 (pthread.c:893)
3   libsystem_pthread.dylib       	0x00000001e291cba4 thread_start + 8 (:-1)


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x000000013b60b630   x1: 0x000000018e84cf54   x2: 0x000000013c200000   x3: 0x000000013c27b390
    x4: 0x00000000000001d0   x5: 0x000000013c27b390   x6: 0x000000000000001e   x7: 0x0000000000000001
    x8: 0x000000013b60b638   x9: 0x0000000200000003  x10: 0xfffffffe00000000  x11: 0x0000000200000003
   x12: 0x0000000000000003  x13: 0x000000013c274a30  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x0000000000000773  x17: 0x0000000000020000  x18: 0x0000000000000000  x19: 0x000000013b60b630
   x20: 0x0000000000000002  x21: 0x0000000000000000  x22: 0x000000000000001d  x23: 0x00000001059d7680
   x24: 0x30000000000001b3  x25: 0x00000001059d769e  x26: 0x000000000000000b  x27: 0x00000002822195e0
   x28: 0x0000000000000000   fp: 0x000000016bc48fd0   lr: 0x000000018e4a9d7c
    sp: 0x000000016bc48f50   pc: 0x000000018e4a9d7c cpsr: 0x60000000
   esr: 0xf2000001 (Breakpoint) brk 1


Binary Images:
        0x1041b0000 -         0x1053d7fff example arm64  <250c1f5f4a4c3199aa46339a86224237> /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/example
        0x1059d0000 -         0x1059dbfff DataStore_171A8F8EE36AD090_PackageProduct arm64   /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/DataStore_171A8F8EE36AD090_PackageProduct.framework/DataStore_171A8F8EE36AD090_PackageProduct
        0x105d00000 -         0x105d77fff RxCocoa arm64   /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/RxCocoa.framework/RxCocoa
        0x1061a0000 -         0x106263fff Content arm64  <1589819614223695988d41d4182dab97> /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/Content.framework/Content
        0x1063cc000 -         0x1065c3fff GoogleCast arm64   /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/GoogleCast.framework/GoogleCast
        0x106a04000 -         0x10734ffff SharedDependencies arm64  <108a002fae6338b4901b3114ae0d559e> /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/SharedDependencies.framework/SharedDependencies
        0x108798000 -         0x10885bfff RxSwift arm64   /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/RxSwift.framework/RxSwift
        0x109c2c000 -         0x10a673fff ExampleLib arm64  <6d619ad07b7c37818368123b733cddb0> /private/var/containers/Bundle/Application/15FBDDC0-8597-4F52-A2E5-35CA3605256C/example.app/Frameworks/ExampleLib.framework/ExampleLib
        0x18e472000 -         0x18e9dafff libswiftCore.dylib arm64e  <56c020fc03693775b947148f388a65b3> /usr/lib/swift/libswiftCore.dylib
        0x18ea0e000 -         0x18f357fff Foundation arm64e   /System/Library/Frameworks/Foundation.framework/Foundation
        0x19469b000 -         0x194a80fff CoreFoundation arm64e  <42ccfc7bff323d258f01ccb2ad843a8b> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
        0x19582f000 -         0x195bf8fff CFNetwork arm64e  <7f3313c9143533338c82dc961429d0b3> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
        0x195d3e000 -         0x19609cfff QuartzCore arm64e  <3f8eddc2623f301fba1d12976c8a60e9> /System/Library/Frameworks/QuartzCore.framework/QuartzCore
        0x196870000 -         0x198063fff UIKitCore arm64e   /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
        0x19bec0000 -         0x19c21efff CoreData arm64e  <6f0fb04dc7f13bbab68888cfc207ace9> /System/Library/Frameworks/CoreData.framework/CoreData
        0x19c643000 -         0x19c6fffff IOKit arm64e   /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
        0x19ceb4000 -         0x19d003ff7 Combine arm64e  <21875d0e7e8f363ab88ae3c27f7d5df7> /System/Library/Frameworks/Combine.framework/Combine
        0x1a2d4d000 -         0x1a2db3ff3 libc++.1.dylib arm64e   /usr/lib/libc++.1.dylib
        0x1a7d7c000 -         0x1a923afff JavaScriptCore arm64e  <79bfba811c1a3c85887ef90ce431c8ab> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
        0x1b2fff000 -         0x1b3082093 dyld arm64e  <4b042f280d1430eca1de3dbb10866ad7> /usr/lib/dyld
        0x1ce910000 -         0x1ce918fff GraphicsServices arm64e  <85419099269b336d86b40d52d0ff6923> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
        0x1d21b8000 -         0x1d21effeb libsystem_kernel.dylib arm64e   /usr/lib/system/libsystem_kernel.dylib
        0x1e2886000 -         0x1e288cff3 libsystem_platform.dylib arm64e  <669859c4444936399597479b5c013750> /usr/lib/system/libsystem_platform.dylib
        0x1e291c000 -         0x1e2927fff libsystem_pthread.dylib arm64e  <45ac734e66493ee2a0963fd66441ab78> /usr/lib/system/libsystem_pthread.dylib

EOF
</a>
Answered by edysudarto in 799047022

If anyone ever come across this thread and having the same issue, we got a response from Apple DTS in our bug report saying that this is memory shortage issue. Hope it helps.

NSSQLiteErrorDomain=13 is error number 13 from sqlite3.h which is SQLITE_FULL. The device is out of disk space.

Accepted Answer

If anyone ever come across this thread and having the same issue, we got a response from Apple DTS in our bug report saying that this is memory shortage issue. Hope it helps.

NSSQLiteErrorDomain=13 is error number 13 from sqlite3.h which is SQLITE_FULL. The device is out of disk space.

Crash when accessing Core Data because file couldn't be opened
 
 
Q