swift
swift copied to clipboard
[SR-15291] Concurrency: Crash when invoking async @objc function
| Previous ID | SR-15291 |
| Radar | None |
| Original Reporter | @mickeyl |
| Type | Bug |
Environment
macOS Big Sur, Xcode 13, iOS 15
Additional Detail from JIRA
| Votes | 0 |
| Component/s | |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 6dd0e24a6fb0f8662c8211501fdd40f3
Issue Description:
Adding the `async` modifier to an `@objc` function crashes when invoking that function via a Notification observer.
The backtrace is here:
(lldb) bt
* thread #​6, queue = 'com.apple.root.default-qos', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #​0: 0x000000010c647928 libobjc.A.dylib`objc_release + 8
frame #​1: 0x000000010d3aba95 Foundation`-[NSConcreteNotification dealloc] + 49
frame #​2: 0x000000010c6479f7 libobjc.A.dylib`objc_object::sidetable_release(bool, bool) + 177
* frame #​3: 0x000000010c1d6b8a SR555`closure #​1 in ViewController.viewDidLoad(self=0x00007fda09807c40) at ViewController.swift:20:40
frame #​4: 0x000000010c1d6c48 SR555`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0
frame #​5: 0x000000010d9d3c0c libdispatch.dylib`_dispatch_client_callout + 8
frame #​6: 0x000000010d9d6595 libdispatch.dylib`_dispatch_continuation_pop + 594
frame #​7: 0x000000010d9eaea0 libdispatch.dylib`_dispatch_source_invoke + 2166
frame #​8: 0x000000010d9d5ecd libdispatch.dylib`_dispatch_queue_override_invoke + 584
frame #​9: 0x000000010d9e5b44 libdispatch.dylib`_dispatch_root_queue_drain + 403
frame #​10: 0x000000010d9e65ec libdispatch.dylib`_dispatch_worker_thread2 + 196
frame #​11: 0x00007fff6bfeb417 libsystem_pthread.dylib`_pthread_wqthread + 244
frame #​12: 0x00007fff6bfea42f libsystem_pthread.dylib`start_wqthread + 15
(lldb)
An example project to clone is here: https://github.com/mickeyl/swift-bugs – directory SR15291
Same in 5.5.2-dev as per Xcode 13.2.0 beta 2.
Likewise in 5.5.2-dev as per Xcode 13.2.0 RC.
Still a problem in Xcode 13.3.0 RC.
Still a problem in 5.6.1 as per Xcode 13.4 RC.
Still a problem in 5.7 as per Xcode 14.0 Beta 1.
Do we know when it will be fixed? Any work arounds while it is being fixed?
None. No progress reports, not even an acknowledgment. It's sad.
Still a problem with Swift 5.9 beta as per Xcode 15 beta. I vaguely recall a discussion where someone said it's not going to be fixed, so it would probably be good to close this as WONTFIX. I'm not going to do this though, since it's not fixed.