Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Darwin hiimtmac.localdomain 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64 Xcode 13.1 Build version 13A1030d Swift version 5.5.1 (swift-5.5.1-RELEASE) Target: x86_64-unknown-linux-gnu
md5: 8dd3461f2b203191394482dd01384ec5
Issue Description:
Allowing an async let to go out of scope without ever await ing it causes a crash.
async let
await
The crash does not happen in LLDB unless the offending async let is within an await ed context.
The following code crashes on Linux, but not on macOS:
import Foundation @main struct SwiftBug { static func main() async throws { print("starting") try await iWillDie() print("done") } static func iWillDie() async throws { async let ones = doAsync() async let twos = doAsync() print(try await ones) if false { print(try await twos) } } static func doAsync() async throws -> [Int] { [1] } }
I've created a repo that reproduces the crash: https://github.com/hiimtmac/swift-bug
LLDB trace:
root@531888c25919:/# lldb .build/debug/Run (lldb) target create ".build/debug/Run" Current executable set to '/.build/debug/Run' (x86_64). (lldb) run Process 19 launched: '/.build/debug/Run' (x86_64) starting [1] Process 19 stopped * thread #​4, name = 'Run', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) frame #​0: 0x00007ffff75f2e50 libswiftCore.so`swift::metadataimpl::ValueWitnesses<swift::metadataimpl::SwiftRetainableBox>::destroy(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) libswiftCore.so`swift::metadataimpl::ValueWitnesses<swift::metadataimpl::SwiftRetainableBox>::destroy: -> 0x7ffff75f2e50 <+0>: movq (%rdi), %rdi 0x7ffff75f2e53 <+3>: jmp 0x7ffff75efe30 ; swift_release 0x7ffff75f2e58: nopl (%rax,%rax) libswiftCore.so`swift::metadataimpl::ValueWitnesses<swift::metadataimpl::SwiftRetainableBox>::initializeWithCopy: 0x7ffff75f2e60 <+0>: pushq %r14 Target 0: (Run) stopped. (lldb) bt * thread #​4, name = 'Run', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) * frame #​0: 0x00007ffff75f2e50 libswiftCore.so`swift::metadataimpl::ValueWitnesses<swift::metadataimpl::SwiftRetainableBox>::destroy(swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) frame #​1: 0x00007ffff77b9db6 libswift_Concurrency.so`_asyncLet_finish_continuation(swift::AsyncContext*, void*) + 86 frame #​2: 0x00007ffff77b86eb libswift_Concurrency.so`swift::runJobInEstablishedExecutorContext(swift::Job*) + 187 frame #​3: 0x00007ffff77b8ce8 libswift_Concurrency.so`swift_job_run + 72 frame #​4: 0x00007ffff701d435 libdispatch.so`_dispatch_continuation_pop + 357 frame #​5: 0x00007ffff701d1e3 libdispatch.so`_dispatch_async_redirect_invoke + 211 frame #​6: 0x00007ffff7029142 libdispatch.so`_dispatch_worker_thread + 514 frame #​7: 0x00007ffff709a609 libpthread.so.0`start_thread + 217 frame #​8: 0x00007ffff6ed9293 libc.so.6`__clone + 67 (lldb)
The text was updated successfully, but these errors were encountered:
@swift-ci create
Sorry, something went wrong.
Hmmm... I thought such issues were fixed; It definitely does not crash on today's recent focal nightly builds.
Hello, I am not seeing this bug anymore.
The above code is emitting the following output when built with the current top-of-tree: ``` starting [1] done ```
Please let us know if you're still seeing this issue.
etcwilde
No branches or pull requests
Environment
Darwin hiimtmac.localdomain 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64 Xcode 13.1 Build version 13A1030d Swift version 5.5.1 (swift-5.5.1-RELEASE) Target: x86_64-unknown-linux-gnu
Additional Detail from JIRA
md5: 8dd3461f2b203191394482dd01384ec5
Issue Description:
Allowing an
async let
to go out of scope without everawait
ing it causes a crash.The crash does not happen in LLDB unless the offending
async let
is within anawait
ed context.The following code crashes on Linux, but not on macOS:
I've created a repo that reproduces the crash: https://github.com/hiimtmac/swift-bug
LLDB trace:
The text was updated successfully, but these errors were encountered: