Reputation: 4862
I have a crash report from an app that has integrated our Swift SDK. I was able to symbolicate it but when I look at the last line of code in the stack trace that is supposed to belong to our SDK, I do not recognize it.
(rest of stack is in Swift Core. Obfuscated names)
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000a00000008
....
7 libswiftCore.dylib 0x00000001007d337c 0x1005ec000 + 1995644
8 libswiftCore.dylib 0x00000001007d33d4 0x1005ec000 + 1995732
9 OurLib 0x00000001003e1ed0 specialized specialized static Array._allocateBufferUninitialized<A>(Int) -> _ArrayBuffer<A> (TheCrashingClass.swift:0)
10 OurLib 0x0000000100420200 specialized static OurLibClass.(startInternal in _9A5ED0808944BC6425F8A2C348E9DA3A)(delegate : NotificationDelegate?, send : Bool) -> () (OurLibClass.swift:0)
11 OurLib 0x0000000100420a70 specialized static OurLibClass.start(NotificationDelegate?, send : Bool) -> () (OurLibClass.swift:47)
12 OurLib 0x000000010041f5b0 @objc static OurLibClass.start(NotificationDelegate?, send : Bool) -> () (OurLibClass.swift:0)
13 TheApp 0x00000001000f8f3c -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:48)
The line in question is this line:
specialized specialized static Array._allocateBufferUninitialized<A>(Int) -> _ArrayBuffer<A> (TheCrashingClass.swift:0)
The stack trace is confusing since OurLibClass doesn't call TheCrashingClass. The client confirmed that a print statement we have enabled at the beginning of the start() call is not being printed. This makes me think that a static property/block is being called on CrashingClass when it is loaded. Here is a stripped down version of the class and attributes.
public class CrashingClass : IProtocolThree, CustomStringConvertible {
public let description = "ADescription"
private let class1: IProtocolOne
private var class2: IProtocolTwo?
private let defaults: NSUserDefaults
private let key: String
private let class4: IProtocolOne
private let callback: () -> ()
private let class3 = Class3()
public private(set) var interval: NSTimeInterval
public var date2: NSDate? { get { } }
public var date1: NSDate? { get { } }
init(class1: IProtocolOne, defaults: NSUserDefaults, key: String, interval: NSTimeInterval, class4: IProtocolFour, callback: () -> ()) {
}
}
It doesn't have any arrays and the only property I could think of that would be getting initialized as an array is the String.
Some other things to note: - I am unable to reproduce this issue on any device (real or simulator) - the crash only happens on certain devices, but when it happens on a device it happens consistently. But, different devices of the same type exhibit different behaviour. For example, one iPad4 (ios 8.0) always crashes while another iPad4 (ios 8.1) doesn't. - App is objc while framework is Swift
My questions are:
specialized specialized static Array._allocateBufferUninitialized(Int) -> _ArrayBuffer (TheCrashingClass.swift:0)
Upvotes: 2
Views: 2421
Reputation: 4862
I wasn't able to narrow down the area of the code with the problem. But, I found the issue.
The problem was that our Swift SDK was built with Xcode 7.1 (using Swift 2.1) and the application was building their application with Xcode 7.0 (using Swift 2.0). If we build our framework with the same version of Xcode all is well. I am super disappointed in Apple in that we shouldn't find issues like this in a minor version upgrade.
Submitted radar 23338116.
Upvotes: 4