[swift-users] Crash with swift_weakLoadStrong in the stack

Greg Parker gparker at apple.com
Mon Feb 13 17:52:58 CST 2017

> On Feb 13, 2017, at 12:18 PM, Jon Shier via swift-users <swift-users at swift.org> wrote:
> Swift Users:
> 	I’m currently seeing a crash in my iOS app that has no apparent cause, but a bit of Swift runtime machinery in the stack has me confused.
> #0. Crashed: com.apple.main-thread
> 0  App                        0x665ac Controller.handleOtherNotification(Notification) -> () (Controller.swift:92)
> 1  libswiftCore.dylib         0x131854f swift_unknownWeakLoadStrong + 10
> 2  App                        0x65cfc Controller.handleFinish(Notification) -> () (Controller.swift)
> 3  App                        0x65dd8 @objc Controller.handleNotification(Notification) -> () + 437720
> Controller.swift: 92 is a call to a custom UIView subclass method that takes an optional date contained extracted from the notification. Any idea what the core callout would be due to? There are no weak or unknown values being used here. Once the notification observers are called it’s all internal to Controller.
> One thing I just noticed is that the line at 3 is the selector for a different notification, which should lead down the path see from 2 onward. It’s redacted and so not easy to see, but in Controller, there’s no path that leads from handleNotification to handleFinish.

That backtrace does look strange. Even if there were some surprising call to swift_unknownWeakLoadStrong() in handleFinish(), there's no way that swift_unknownWeakLoadStrong() would call handleOtherNotification().

(swift_unknownWeakLoadStrong + 10 is the instruction after a call, assuming you're on 64-bit iOS simulator, but that call is to swift::isNativeSwiftWeakReference() which itself doesn't call anything.)

Also, in frame 3, the byte offset from the start of handleNotification() is larger than the address itself. And all of these addresses look too small if you're on 64-bit.

Where did this backtrace come from? Do you have a crash log as generated by the OS?

Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170213/bc6f85c7/attachment.html>

More information about the swift-users mailing list