swift: withCheckedContinuation crashes on Xcode 16 RC
Description
I can reproduce on Xcode 16 RC and Xcode 16.1 beta, but ONLY when running the app as “Designed for iPhone/iPad” on macOS Sonoma, and ONLY in debug mode (crash goes away in release mode).
I cannot reproduce by running on iOS 17 or 18 neither device nor simulator, and cannot reproduce either when running on macOS Sequoia beta.
Some developers have reported the issue also reproduces when installing the app via TestFlight on an iOS 18 device.
Original issue: https://github.com/RevenueCat/purchases-ios/issues/4177
FB14855530
Reproduction
_ = try await withCheckedContinuation { continuation in
continuation.resume(returning: true)
}
Stack dump
Thread 0 Crashed:
0 asdfsadf.debug.dylib 0x102551354 withCheckedContinuation<A>(isolation:function:_:) + 232
1 asdfsadf.debug.dylib 0x102551135 closure #1 in closure #2 in ContentView.body.getter + 1 (ContentView.swift:21)
2 asdfsadf.debug.dylib 0x102552299 partial apply for closure #1 in closure #2 in ContentView.body.getter + 1
3 libswift_Concurrency.dylib 0x2548aa0f9 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1
Expected behavior
It doesnt crash
Environment
Xcode 16.1 beta 1
Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 16
- Comments: 22 (5 by maintainers)
Check with these users, they are most likely on an older beta version of iOS 18. I can confirm all our users were on an older beta version and updating to the latest iOS version fixed these crashes for them.
This is a known issue documented in the Xcode 16 release notes (search for 134793410). It was addressed on the
release/6.0.1branch here: [6.0.1] SILOptimizer: Allow inlining of transparent functions in@backDeployedthunks by tshortli · Pull Request #76218 · swiftlang/swift · GitHub. Designed for iPhone/iPad binaries built with debug optimizations and deployed to macOS Sonoma or earlier are affected.Same issue for me.
I’m on Xcode 16.1 beta.
App crashes like @MarkVillacampa described with only iOS 18 simulators.
Thread 1: EXC_BAD_ACCESS (code=1, address=0x4)
@kiran-nayak-cheq Looks like the issue has been fixed in the updated version? https://developer.apple.com/forums/thread/761580 https://forums.developer.apple.com/forums/thread/762682?page=1#803104022
This was addressed in Swift 6.0.1.
@HoonHaChoi you should ask the users of your app to upgrade their iOS version to the latest. They’re most likely (read: for sure) on one of the earlier beta versions with the issue. This is no longer an issue with 18 RC or above.
I have just updated to: MacOS: 15.1.1 (24B91) Xcode: Version 16.1 (16B40) swift --version produces: swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) IOS-18.0 sims crash. IOS-18.1 and 17.2 simulators do not crash
This is specifically when building for development.
For what its worth a coworker building the same application with these same versions does not cause the same crash.
Edit, This is for Rosetta Simulators.
hello. I am still experiencing the same issue. Is anyone else having the same problem as me? I deployed the app in the following environment
Environment
Xcode-16.1(16B40) swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4) Target: arm64-apple-macosx14.0
I have not been able to reproduce the crash in apps built on my local Mac, but it seems to happen in apps uploaded to the app store.
I’m facing the same Thread 1:
EXC_BAD_ACCESS (code=1, address=0x4)issue with Xcode Version 16.0 and iOS 18.0, but it only occurs on specific devices and isn’t consistently reproducible. this crash seems to depend on the specific device or scenario. It would be great if this could be investigated further to understand the underlying cause and ensure stability.I’m using Swift 5 with Xcode 16. Below is a sample code to demonstrate the issue:
The crash occurs when navigating between screens while the API call is still in progress, which leads to an
EXC_BAD_ACCESS error. This only seems to happen on specific devices runningiOS 18.0, and it’s not consistently reproducible.We’re seeing this for our publicly released apps using Xcode version 16.0 (16A242d) (published, final updates to App Store, not debug versions) where random users are seeing persistent crashes at launch and the stack traces are vague. We see the following in each of them though:
We are personally unable to reproduce this in any environment (debug / release) or on any OS. The users experiencing this range from being on macOS 11 to macOS 15, and iOS 16 / 18. It could potentially be affecting all operating system versions but we are unable to say this with certainty. We are using Xcode 16 to compile our apps using Swift v5 (5.10, not 6). The last update posted from Xcode 15 does not exhibit this issue.
Quick update:
withCheckedThrowingContinuationas well: