Closed 0xTim closed 3 years ago
This crash seems to be in the Swift runtime itself. I can see from the backtraces that you are already running under TSAN, so I assume this crash is not the result of a thread-safety issue. In that case, I suspect the issue is in the Swift runtime itself.
Can you produce a smaller reproducer scenario?
@Lukasa I've updated with a small repro
Just to add a data point to this which probably will not comfort you much - your example works for me.
We appear to have the same swift (which I was surprised by).
@0xTim What OS and Xcode is this reproducing with?
@Lukasa macOS 11.4 and Xcode 13 Beta 1. Just tested on macOS 12 and it works for me too on there
Concurrency features don't work on macOS 11.4, so I'm not surprised this doesn't work there. Closing because this is a Swift issue.
Just as an FYI, I am on macOS 12 with Xcode 13 beta 2 and a similar crash is now happening in this function for a Vapor project using async/await. It worked with beta 1.
Currently trying to diagnose it.
Did you get anywhere with this?
@Lukasa this is crashing on macOS 12.0 Beta and Xcode 13 Beta 2. Here are the updated details, reproduction steps are the same:
2.30.0
swift-driver version: 1.26 Apple Swift version 5.5 (swiftlang-1300.0.20.104 clang-1300.0.21.1)
Target: x86_64-apple-macosx12.0
Darwin Tims-MBP-2018.brokenhands.net 21.0.0 Darwin Kernel Version 21.0.0: Thu May 27 21:01:58 PDT 2021; root:xnu-7938.0.0.111.2~2/RELEASE_X86_64 x86_64
(lldb) bt all
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xfffffffffffffff8)
frame #0: 0x000000010018d0ba AsyncCrashSmall`EventLoopPromise.completeWithAsync(body=0x10019bcd0, self=NIO.EventLoopPromise<Swift.String> @ 0x00000001045ab198) at AsyncAwaitSupport.swift:0
* frame #1: 0x0000000100004a78 AsyncCrashSmall`makeString() at main.swift:7:13
frame #2: 0x0000000100004847 AsyncCrashSmall`main at main.swift:17:20
frame #3: 0x00000001005094d5 dyld`start + 421
Thanks @0xTim, I'll try to put together a repro on my end.
Is it worth reopening this?
Yup.
This appears to work in Monterey Beta 2
Yeah confirmed, was just a rev lock issue. Should have occurred to me, apologies.
So, can I conclude that this is a macOS 11.4 issue and that this works fine in macOS 12?
I'm asking because I'm working on a project that worked fine with Xcode 13 beta 1 on macOS 11.4, but this crash now happens after upgrading to beta 3. I see the crash happening both in my own project as well as the example 0xTim provided in the original post.
Versions in use:
If the crash was introduced somewhere between beta 1 and 3, is this really a Monterey issue?
(I only have one Mac, and can't afford to install beta OS on this so I can't confirm myself. Wish Apple would provide some form of virtualization feature to test the beta OS)
Are you sure you’re getting a crash in completeWithAsync
?
None of the async features will run on macOS 11. They should be hidden behind an availability guard that makes them literally unreachable on your platform.
Yeah, the availability guard gets ignored by this flag in Package.swift:
.unsafeFlags([
"-Xfrontend", "-disable-availability-checking",
Anyway, I found the issue: Xcode-beta 3 reverted to its built in tool chain. After downloading and choosing the latest toolchain for Swift 5.5 from swift.org, it works again.
Hey there, I actually got this same crash recently, I'm running Xcode 13.2.1 on macOS 11.6.8, unfortunately I cannot update to Xcode 13.3 or anything above because I do not have Monterey installed, and I can't install Monterey because my MBP is from mid-2014. However, I have managed to get around the crash by installing the latest toolchain from swift.org (Swift 5.6.3 Release at the time). Since the old discussion was around betas I thought it would be worth sharing this in case others have the same issue as I had recently. Thanks
Expected behavior
Promise to return async result
Actual behavior
Crashes with
NIO-ELT-0-#5 (8): EXC_BAD_ACCESS (code=1, address=0x0)
. Stacktrace is below. The code is:Steps to reproduce
git clone https://github.com/0xTim/AsyncCrash.git
cd AsyncCrash
swift run
SwiftNIO version/commit hash
2.29.0
Swift & OS version (output of
swift --version && uname -a
)Stacktrace