Skip to content
New issue

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

[SR-12511] Swift 5.2 / Xcode 11.4 apps crash on 32 bit devices in SingletonMetadata #54953

Open
swift-ci opened this issue Apr 4, 2020 · 10 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 4, 2020

Previous ID SR-12511
Radar rdar://problem/62202462
Original Reporter bridger (JIRA User)
Type Bug
Environment

iPad 2 and iPad 3 on iOS 9 and 10. Xcode 11.4. Release profile.

Additional Detail from JIRA
Votes 7
Component/s
Labels Bug
Assignee None
Priority Medium

md5: c797842ac8094b300390cbd789c763aa

Issue Description:

My app compiled with Xcode 11.4 started getting hundreds of crashes on 32 bit devices (iOS 9 and 10).

On my iPad 2 I see a crash quickly after booting the app. This is the trace:

{{ * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)}}
{{ * frame #0: 0x00000000}}
{{ frame #1: 0x01394f70 libswiftCore.dylib`SingletonMetadata + 24}}
{{ frame #2: 0x013819d4 libswiftCore.dylib`__SwiftNativeNSError + 20}}
{{ frame #3: 0x013819e8 libswiftCore.dylib`_TtCs12_SwiftObject + 20}}
{{ frame #4: 0x013819d4 libswiftCore.dylib`__SwiftNativeNSError + 20}}

The crash only repros on Xcode 11.4 with the Release profile.

Most of the crashes reported by Crashlytics were unique stack traces which happened to be in third party SDKs, but I don't think the SDKs were the actual cause. I believe Crashlytics for some reason has trouble capturing the above crash trace because none of the crashes had the metadata about which thread crashed and what the crash reason was.

{{Here are a couple Github issues about this crash which were mistakenly put on the SDKs: firebase/firebase-ios-sdk#5233 (comment) https://github.com/freshdesk/freshchat-ios/issues/99 }}

@swift-ci
Copy link
Collaborator Author

Comment by Alexander Serdobintsev (JIRA)

We've faced the same issue on 32-bit devices (iPhone 5, iPhone 5c, iPad 4) with iOS 10.

Optimization Level - Fastest, Smallest [-Os].

Our crash happens when OS switches from other thread to main:

// other thread execution here (actually completionHandler called by NSURLSession)
dispatch_async(dispatch_get_main_queue(), ^{ // crash on this line!
    // some code here
});

@swift-ci
Copy link
Collaborator Author

Comment by Uli Niggemann (JIRA)

We also received thousands of crashes on iPads and iPhones with 32-Bit and iOS 9 or 10. Mainly from some google/firebase internals right on startup - recompiling with Xcode 11.3.1 seems to fix the issues.

@swift-ci
Copy link
Collaborator Author

Comment by victor (JIRA)

I figure out the real reason.
After lots of work such as log and instruction debugging, I am surely it's a bug xcode 11.4 swift compiler optimization. Detailly, the optimization cause a stack pointer (fp) at the point opening a new function stack frame. I show it in the following.
Refer to this
https://stackoverflow.com/questions/61074507/app-crash-xcode11-4-ios-10-3-3-10-3-4-iphone-5c-5-ipad4-armv7s/61223586#61223586

@beccadax
Copy link
Contributor

@swift-ci create

@eeckstein
Copy link
Member

Thanks for reporting. We are already aware of the problem and it will be fixed in an upcoming release.

@swift-ci
Copy link
Collaborator Author

Comment by Pedro Paulo de Amorim (JIRA)

@eeckstein Hi, I might be wrong but I was able to detect the same issue on an iPhone 8 running iOS 13. https://imgur.com/a/FrQbTd7

@swift-ci
Copy link
Collaborator Author

Comment by Kiel (JIRA)

@eeckstein Is Xcode 11.5 the upcoming release with this fix?

@eeckstein
Copy link
Member

kielgillard (JIRA User) yes

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 3, 2020

Comment by Bridger Maxwell (JIRA)

pp.amorim (JIRA User)I don't think that the crash you are seeing on iOS 13 is the same bug. Before we knew that this was a compiler bug with armv7 (32 bit) we thought it might be firebase/firebase-ios-sdk#4278 which was a bug caused by sqlite multithreading. Maybe that will be useful for debugging your issue.

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 5, 2020

Comment by Pedro Paulo de Amorim (JIRA)

bridger (JIRA User) That's ok. The strange part of the report is that Firebase crash log is equals to the crashes reported from arm7 devices, even the same function and line. That's why I suspect it could be a similar issue. The Issue opened at `firebase-ios-sdk` loops to this bug report.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

3 participants