Strange crash in globalinit

I've recently started seeing a crash in an app that jumps from our code, to Swift memory machinery in an internal framework:

Crashed: com.apple.main-thread
0  Framework                   0x1019e2528 globalinit_33_7714F0E7526EB8FECE3E615FE49C1D7B_func0 + 14060
1  Framework                   0x1019d8a0c __swift_memcpy1_1 + 5280
2  App                         0x1004a90a8 ViewController.ViewModel.update() (<compiler-generated>)
3  App                         0x1004c278c ViewController.perform() (<compiler-generated>)

I've tried various ways of capturing the variables referred to in 2, but nothing changes. It looks like this:

func update() {
    views.forEach { $0.update() }
}

Where views is an array of a custom view type from the framework. It's loaded from a xib and loads images from PDFs.

The crash only seems to occur in Enterprise builds through Crashlytics. I can't reproduce it locally, with or without optimization. Nothing has changed in regards to linking the framework, and the crash occurs when built in Xcode 10.3 and 11.1.

Any ideas for causes or investigative avenues?

This appears to have been caused by the forced access of a PDF image that was somehow corrupted. Replacing the image with a newly generated copy fixed the issue. Why the crash looked like that, who knows.

Without a dSYM, the symbolicator tends to grab the nearest symbol it can find to symbolicate a code address. globalinit_33_7714F0E7526EB8FECE3E615FE49C1D7B_func0 + 14060 is likely to be some unrelated function, and globalinit_33_7714F0E7526EB8FECE3E615FE49C1D7B_func0 happened to be the last named symbol in the binary.

Odd. This was from Crashlytics, which had symbolicated the rest of the crash stack and has our dSYM files as part of the build upload process.

And you copy pasted the same symbol twice, so I'm not sure what you mean here.

Sorry, I mean that it's unlikely that globalinit_33_7714F0E7526EB8FECE3E615FE49C1D7B_func0 is really 14,060 bytes long, and that the address is some other unsymbolicated function that happens to come after it.

Terms of Service

Privacy Policy

Cookie Policy