We are seeing a swift concurrency related crash in iOS 18 and iOS 18.1 that has no direct link to any part of my code base in the stack trace. We are not able to reproduce locally but see it in the Organizer. The crash seems to come from withTaskCancellationHandler in Concurrency.swift
Incident Identifier: C5331198-3922-471F-8E39-57186BBB962B
Distributor ID: com.apple.AppStore
Hardware Model: iPhone16,2
Process: MyApp [866]
Path: /private/var/containers/Bundle/Application/B320C8CF-5711-4F14-92C4-0693420DDE07/MyApp.app/MyApp
Identifier: com.MyApp.release
Version: 10.0.1 (1)
AppStoreTools: 16A242b
AppVariant: 1:iPhone16,2:18
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.MyApp.release [989]
Date/Time: 2024-09-21 06:30:38.3210 -0500
Launch Time: 2024-09-21 06:18:03.0691 -0500
OS Version: iPhone OS 18.1 (22B5007p)
Release Type: Beta
Baseband Version: 2.15.01
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000004
Exception Codes: 0x0000000000000001, 0x0000000000000004
VM Region Info: 0x4 is not in any region. Bytes before following region: 4340908028
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102bd0000-102be0000 [ 64K] r-x/r-x SM=COW /var/containers/Bundle/Application/B320C8CF-5711-4F14-92C4-0693420DDE07/MyApp.app/MyApp
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [866]
Triggered by Thread: 3
Thread 3 Crashed:
0 MyApp 0x0000000103b00b8c withTaskCancellationHandler<A>(operation:onCancel:isolation:) + 108 (/<compiler-generated>:0)
1 MyApp 0x0000000103b0284d closure #1 in DataRequest.dataTask<A>(automaticallyCancelling:forResponse:) + 1 (Concurrency.swift:352)
2 MyApp 0x0000000102f66011 partial apply for closure #1 in closure #1 in variable initialization expression of static FireAndForgetKey.liveValue + 1
3 MyApp 0x0000000102f80841 closure #1 in DataTask.response.getter + 1
4 MyApp 0x0000000102f66011 partial apply for closure #1 in closure #1 in variable initialization expression of static FireAndForgetKey.liveValue + 1
5 libswift_Concurrency.dylib 0x000000019164e689 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:471)
Post
Replies
Boosts
Views
Activity
SwiftUI Previews that work in Xcode 15.2 now fail in Xcode 15.3 with failedToGenerateThunkInfo error
I have a Swift Package Manager module with some SwiftUI files that I was using Previews without issues in Xcode 15.2. When I upgraded to Xcode 15.3, it fails with “Cannot preview in this file. Unexpected error occurred”. When I click to get more info, this is the error:
== PREVIEW UPDATE ERROR:
HumanReadableSwiftError
BuildError: failedToGenerateThunkInfo(could not generate preview info: noTargetBuildGraph)
Is anyone experiencing the same problems? My preview, which lives in a SPM package, works totally fine in Xcode 15.2, but fails in Xcode 15.3. Any ideas for how to fix it? I've tried deleting DerivedData, resetting package caches, clean building.
So frustrating seeing these regression issues popping up still.
I filed FB13678356 but it was quickly marked as "Investigation Complete - Unable to diagnose with current information" but there was no request for what further information I could provide! I attached a full sysdiagnose and error log!
Would also note, that when I revert back to Xcode 15.2, the previews go back to working...
We have started seeing a bunch of crashes in my app with the following crash log:
Seems to happen inconsistently in the app and we are not able to replicate the crash locally. Does anyone have any idea what the crash might be caused by? Is it a bug in iOS 17?
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes: 0x0000000000000001, 0x0000000000000000
VM Region Info: 0 is not in any region. Bytes before following region: 4343709696
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102e7c000-102e8c000 [ 64K] r-x/r-x SM=COW ...ea.app/MyApp
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [71670]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 libsystem_platform.dylib 0x000000022147ced4 _platform_memmove + 52
1 QuartzCore 0x00000001b9a66864 CA::Render::InterpolatedFunction::encode(CA::Render::Encoder*) const + 248 (render-function.cpp:591)
2 QuartzCore 0x00000001b9a66684 CA::Render::GradientLayer::encode(CA::Render::Encoder*) const + 44 (render-gradient-layer.cpp:658)
3 QuartzCore 0x00000001b995eb6c CA::Render::Layer::encode(CA::Render::Encoder*) const + 284 (render-layer.cpp:5504)
4 QuartzCore 0x00000001b995ea0c CA::Render::encode_set_object(CA::Render::Encoder*, unsigned long, unsigned int, CA::Render::Object*, unsigned int) + 196 (render-coding.cpp:2822)
5 QuartzCore 0x00000001b995be3c invocation function for block in CA::Context::commit_transaction(CA::Transaction*, double, double*) + 244 (CAContextInternal.mm:3657)
6 QuartzCore 0x00000001b995bce4 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 368 (CALayer.mm:2786)
7 QuartzCore 0x00000001b995bc70 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252 (CALayer.mm:2772)
8 QuartzCore 0x00000001b995bca4 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 304 (CALayer.mm:2779)
9 QuartzCore 0x00000001b995bc70 CA::Layer::commit_if_needed(CA::Transaction*, void (CA::Layer*, unsigned int, unsigned int) block_pointer) + 252 (CALayer.mm:2772)
10 QuartzCore 0x00000001b99a0334 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 11192 (CAContextInternal.mm:3662)
11 QuartzCore 0x00000001b9996c3c CA::Transaction::commit() + 648 (CATransactionInternal.mm:432)
12 QuartzCore 0x00000001b99968e4 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:942)
13 UIKitCore 0x00000001ba5f7228 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3158)
14 UIKitCore 0x00000001ba5f6d40 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:119)
15 UIKitCore 0x00000001ba5f6430 schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:1037)
16 UIKitCore 0x00000001ba5f64ec runloopSourceCallback + 92 (_UIUpdateScheduler.m:1186)
17 CoreFoundation 0x00000001b8370acc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
18 CoreFoundation 0x00000001b836fd48 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
19 CoreFoundation 0x00000001b836e4fc __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
20 CoreFoundation 0x00000001b836d238 __CFRunLoopRun + 828 (CFRunLoop.c:2955)
21 CoreFoundation 0x00000001b836ce18 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
22 GraphicsServices 0x00000001fae315ec GSEventRunModal + 164 (GSEvent.c:2196)
23 UIKitCore 0x00000001ba77b2fc -[UIApplication _run] + 888 (UIApplication.m:3690)
24 UIKitCore 0x00000001ba77a938 UIApplicationMain + 340 (UIApplication.m:5275)
25 UIKitCore 0x00000001ba99e44c UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:539)
26 MyApp 0x0000000102e8da4c specialized static UIApplicationDelegate.main() + 28 (<compiler-generated>:27)
27 MyApp 0x0000000102e8da4c static AppDelegate.$main() + 28 (AppDelegate.swift:0)
28 MyApp 0x0000000102e8da4c main + 120
29 dyld 0x00000001dab57d44 start + 2104 (dyldMain.cpp:1269)
The below code used to compile for iOS 16.0 and above when using Xcode 15.2. Now it seems that ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest.excludeCredentials is only available on iOS 17.4 an above in Xcode 15.3? Is there any reason that's the case?
let request = ASAuthorizationPlatformPublicKeyCredentialProvider(relyingPartyIdentifier: id).createCredentialRegistrationRequest(challenge: challengeData, name: name, userID: userIDData)
// ERROR: 'excludedCredentials' is only available in iOS 17.4 or newer
request.excludedCredentials = registrationOptions.excludeCredentials
I am getting an occasion crash when using several async let in a swiftUI task. The crash is sporadic and I'm really struggling to pin down the main cause. I am unable to repeatedly reproduce it though I have observed it happening locally. I am seeing the crash logs come in via Organizer.
The code and crash logs are shown below. Really appreciate any advice on where to start pinning down this issue. Thank you!
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000050
Exception Codes: 0x0000000000000001, 0x0000000000000050
VM Region Info: 0x50 is not in any region. Bytes before following region: 4330717104
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102218000-102224000 [ 48K] r-x/r-x SM=COW ...ea.app/****
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [75970]
Triggered by Thread: 12
Thread 12 name:
Thread 12 Crashed:
0 libswift_Concurrency.dylib 0x000000022746e8e4 swift_task_create_commonImpl(unsigned long, swift::TaskOptionRecord*, swift::TargetMetadata<swift::InProcess> const*, void (swift::AsyncContext* swift_async_context) swiftasynccall*, void*, unsigne... + 448 (MetadataValues.h:189)
1 libswift_Concurrency.dylib 0x000000022746e83c swift_task_create_commonImpl(unsigned long, swift::TaskOptionRecord*, swift::TargetMetadata<swift::InProcess> const*, void (swift::AsyncContext* swift_async_context) swiftasynccall*, void*, unsigne... + 280 (Task.cpp:507)
2 libswift_Concurrency.dylib 0x000000022746c614 swift_asyncLet_begin + 40 (AsyncLet.cpp:188)
3 ******* 0x00000001025a4764 CommonClient.preload(id:) + 344 (Preloaders.swift:15)
4 ******* 0x00000001023b0639 closure #3 in View.body.getter + 1 (View.swift:72)
5 ******* 0x00000001023b0859 partial apply for closure #3 in View.body.getter + 1 (<compiler-generated>:0)
6 SwiftUI 0x00000001ae6e0b01 $s7SwiftUI13_TaskModifierV05InnerD033_293A0AF83C78DECE53AFAAF3EDCBA9D4LLV4body7contentQrAA05_ViewD8_ContentVyAFG_tFyycfU_yyYaYbcfU_TQ0_ + 1 (TaskModifier.swift:197)
7 SwiftUI 0x00000001ae6e82f5 $s7SwiftUI13_TaskModifierV05InnerD033_293A0AF83C78DECE53AFAAF3EDCBA9D4LLV4body7contentQrAA05_ViewD8_ContentVyAFG_tFyycfU_yyYaYbcfU_TATQ0_ + 1 (<compiler-generated>:0)
8 SwiftUI 0x00000001ae6e3d0d $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TQ0_ + 1 (<compiler-generated>:0)
9 SwiftUI 0x00000001ae6e7b91 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_ + 1 (<compiler-generated>:0)
10 libswift_Concurrency.dylib 0x0000000227470081 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:399)
Here is the slightly redacted crashing code:
/// SwiftUI Task modifier that makes async call
public var body: some View {
VStack {}
.task {
await client.preload(id: id)
}
}
// Async preloading function that uses async let to cache the result of 3 network calls
func preload(id: String) async {
print("PRELOADING:", id)
async let res1: CachedResponse<Response1> = request(id)
async let res2 CachedResponse<Response2> = request(id)
async let res3: CachedResponse<Response3> = request(id)
let _ = try? await res1
let _ = try? await res2
let _ = try? await res3
}