Crash in DataStack.swift deinit for background task #406

Closed
opened 2025-12-29 15:31:05 +01:00 by adam · 2 comments
Owner

Originally created by @jimbengtsson92 on GitHub (Apr 14, 2023).

I have received a crash in crashlytics which comes from the deinit in DataStack.swift for a background task.

Stack trace:

Crashed: com.apple.BGTaskScheduler (com.wmobile.servicetech.refresh)
0 libswiftCore.dylib 0x3da11c _swift_release_dealloc + 32
1 Service 0x5f8fc0 DataStack.deinit + 4311732160 (:4311732160)
2 Service 0x5f9030 DataStack.__deallocating_deinit + 593 (DataStack.swift:593)
3 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56
4 libswiftCore.dylib 0x3db120 bool swift::HeapObjectSideTableEntry::decrementStrong<(swift::PerformDeinit)1>(unsigned int) + 292
5 Service 0xc924 CoreStoreCache.__deallocating_deinit + 4305520932 (:4305520932)
6 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56
7 Service 0x1d136c PhoneCacheUpdater.deinit + 4307374956 (:4307374956)
8 Service 0x1d13bc PhoneCacheUpdater.__deallocating_deinit + 47 (PhoneCacheUpdater.swift:47)
9 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56
10 libswiftCore.dylib 0x3db120 bool swift::HeapObjectSideTableEntry::decrementStrong<(swift::PerformDeinit)1>(unsigned int) + 292
11 libswiftCore.dylib 0x3dc76c swift::metadataimpl::ValueWitnessesswift::metadataimpl::SwiftRetainableBox::assignWithCopy(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadataswift::InProcess const*) + 52
12 libswiftCore.dylib 0x3f95d0 swift::metadataimpl::OpaqueExistentialBox<1u>::Container* swift::metadataimpl::OpaqueExistentialBoxBase::assignWithCopy<swift::metadataimpl::OpaqueExistentialBox<1u>::Container>(swift::metadataimpl::OpaqueExistentialBox<1u>::Container*, swift::metadataimpl::OpaqueExistentialBox<1u>::Container*) + 588
13 libswiftCore.dylib 0x39f714 assignWithCopy for ClosedRange<>.Index + 336
14 Service 0x1c9a3c outlined assign with copy of RemoteConfigProvider? + 4307343932
15 Service 0x1beed8 closure #1 in AppDelegate.setupBackgroundTasks() + 4307300056 (:4307300056)
16 Service 0x1b9dd4 thunk for @escaping @callee_guaranteed (@guaranteed UNNotificationSettings) -> () + 4307279316 (:4307279316)
17 BackgroundTasks 0x496c __41-[BGTaskScheduler _runTask:registration:]_block_invoke.91 + 196
18 libdispatch.dylib 0x2460 _dispatch_call_block_and_release + 32
19 libdispatch.dylib 0x3f88 _dispatch_client_callout + 20
20 libdispatch.dylib 0xb640 _dispatch_lane_serial_drain + 672
21 libdispatch.dylib 0xc1c0 _dispatch_lane_invoke + 436
22 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652
23 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288
24 libsystem_pthread.dylib 0xb98 start_wqthread + 8

Screenshot 2023-04-14 at 09 19 23
Originally created by @jimbengtsson92 on GitHub (Apr 14, 2023). I have received a crash in crashlytics which comes from the deinit in DataStack.swift for a [background task](https://developer.apple.com/documentation/backgroundtasks/bgtask). Stack trace: > Crashed: com.apple.BGTaskScheduler (com.wmobile.servicetech.refresh) > 0 libswiftCore.dylib 0x3da11c _swift_release_dealloc + 32 > 1 Service 0x5f8fc0 DataStack.deinit + 4311732160 (<compiler-generated>:4311732160) > 2 Service 0x5f9030 DataStack.__deallocating_deinit + 593 (DataStack.swift:593) > 3 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56 > 4 libswiftCore.dylib 0x3db120 bool swift::HeapObjectSideTableEntry::decrementStrong<(swift::PerformDeinit)1>(unsigned int) + 292 > 5 Service 0xc924 CoreStoreCache.__deallocating_deinit + 4305520932 (<compiler-generated>:4305520932) > 6 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56 > 7 Service 0x1d136c PhoneCacheUpdater.deinit + 4307374956 (<compiler-generated>:4307374956) > 8 Service 0x1d13bc PhoneCacheUpdater.__deallocating_deinit + 47 (PhoneCacheUpdater.swift:47) > 9 libswiftCore.dylib 0x3da134 _swift_release_dealloc + 56 > 10 libswiftCore.dylib 0x3db120 bool swift::HeapObjectSideTableEntry::decrementStrong<(swift::PerformDeinit)1>(unsigned int) + 292 > 11 libswiftCore.dylib 0x3dc76c swift::metadataimpl::ValueWitnesses<swift::metadataimpl::SwiftRetainableBox>::assignWithCopy(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) + 52 > 12 libswiftCore.dylib 0x3f95d0 swift::metadataimpl::OpaqueExistentialBox<1u>::Container* swift::metadataimpl::OpaqueExistentialBoxBase::assignWithCopy<swift::metadataimpl::OpaqueExistentialBox<1u>::Container>(swift::metadataimpl::OpaqueExistentialBox<1u>::Container*, swift::metadataimpl::OpaqueExistentialBox<1u>::Container*) + 588 > 13 libswiftCore.dylib 0x39f714 assignWithCopy for ClosedRange<>.Index + 336 > 14 Service 0x1c9a3c outlined assign with copy of RemoteConfigProvider? + 4307343932 > 15 Service 0x1beed8 closure #1 in AppDelegate.setupBackgroundTasks() + 4307300056 (<compiler-generated>:4307300056) > 16 Service 0x1b9dd4 thunk for @escaping @callee_guaranteed (@guaranteed UNNotificationSettings) -> () + 4307279316 (<compiler-generated>:4307279316) > 17 BackgroundTasks 0x496c __41-[BGTaskScheduler _runTask:registration:]_block_invoke.91 + 196 > 18 libdispatch.dylib 0x2460 _dispatch_call_block_and_release + 32 > 19 libdispatch.dylib 0x3f88 _dispatch_client_callout + 20 > 20 libdispatch.dylib 0xb640 _dispatch_lane_serial_drain + 672 > 21 libdispatch.dylib 0xc1c0 _dispatch_lane_invoke + 436 > 22 libdispatch.dylib 0x16e10 _dispatch_workloop_worker_thread + 652 > 23 libsystem_pthread.dylib 0xdf8 _pthread_wqthread + 288 > 24 libsystem_pthread.dylib 0xb98 start_wqthread + 8 <img width="1168" alt="Screenshot 2023-04-14 at 09 19 23" src="https://user-images.githubusercontent.com/74904815/231972131-27593eb4-ae8d-467f-be8a-5433b3c45620.png">
adam closed this issue 2025-12-29 15:31:05 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Apr 14, 2023):

KERN_INVALID_ADDRESS just means you have a dangling pointer. You'd need to look for those leaks in your app

@JohnEstropia commented on GitHub (Apr 14, 2023): KERN_INVALID_ADDRESS just means you have a dangling pointer. You'd need to look for those leaks in your app
Author
Owner

@jimbengtsson92 commented on GitHub (Apr 17, 2023):

@JohnEstropia Ok thanks for the feedback.

@jimbengtsson92 commented on GitHub (Apr 17, 2023): @JohnEstropia Ok thanks for the feedback.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#406