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-9256] Crash on 32-bit iOS Devices #51736

Closed
swift-ci opened this issue Nov 14, 2018 · 14 comments
Closed

[SR-9256] Crash on 32-bit iOS Devices #51736

swift-ci opened this issue Nov 14, 2018 · 14 comments

Comments

@swift-ci
Copy link
Collaborator

@swift-ci swift-ci commented Nov 14, 2018

Previous ID SR-9256
Radar rdar://problem/46076755
Original Reporter MonocularVision (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

iOS 10.3.x+
32-bit Devices (iPhone 5, iPhone 5C, iPad 4)
Xcode 10.0 (10A255)
Swift 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 32BitOnly, 4.2Regression, RunTimeCrash
Assignee None
Priority Medium

md5: 9ebc60515fece58cf93f5b337ec1e4b8

Issue Description:

After upgrading to Xcode 10.0 (10A255) with Swift 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1), we are experiencing a large number of crashes on 32-bit devices (iPhone 5, iPhone 5C and iPad 4) running iOS 10.3.x. We only support iOS 10 and up so these are the only 32-bit devices in our user base.

I'm unable to attach the crash reports here, but I've created a radar #46076755 with the crash reports. The crashes are not identical but share a lot of commonalities and a similar set of calls are in the stack. We are able to reproduce these crashes.

While I cannot send our entire project, I can attach requested source files to the Radar if that would help. I'm working on trying to reduce the problem down to a smaller project but wanted to get this opened ASAP.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Nov 15, 2018

Looks like it's crashing while hashing a string as part of doing a dictionary subscript. Can you share the code around the last stack frame in your code, and describe where the keys in that dictionary come from? (Sharing on Radar is perfectly fine, of course, if you don't want to show the world.)

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Nov 15, 2018

Comment by Michael McGuire (JIRA)

I've attached the source code for the various files involved in the first 5 or so crashes. The SelectedCardViewController.runner(for:) seems to be the commonality with these crashes, although it happens in different places. I noticed that at or just below each of these crashes there is a call to makeFeatureRunner which does some type erasure. Perhaps this is related to SR-9103? Unfortunately, I don't see any dictionary subscripting in where these crashes are happening, so not sure how to answer the part about keys in the dictionary. Let me know if there is any additional code that would be helpful.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Nov 27, 2018

After looking at the crash logs more thoroughly, it looks like some sort of general memory corruption but I don't have much in the way of specifics. A lot of the crashes happen when it gets a bad class pointer out of an object. Unfortunately I haven't been able to figure out what might be causing it. Any luck with a reduced example?

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Nov 29, 2018

Comment by Michael McGuire (JIRA)

@mikeash Not yet, but we're still working on it! Hopefully should have something soon.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 13, 2018

Comment by Justin Swart (JIRA)

Hi, are there any ways we could attempt to workaround this? We are also experiencing a high number of `outlined copy of Optional?` crashes on iOS 9.x and 10.x devices since updating to Swift 4.2.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 13, 2018

I don't understand the crash well enough to recommend anything yet. If you'd like to attach whatever crash logs and source code you can, it might be useful to compare with the ones reported by Michael. Please feel free to attach them to a radar as Michael has done if you don't want to share them here.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 13, 2018

Comment by Justin Swart (JIRA)

Thanks for the reply, Mike.

I've attached a crash log for this.

Fortunately our codebase is open-source, so here are a few links to relative source files:

Crash entry-point: https://github.com/kickstarter/ios-oss/blob/master/Library/ViewModels/DiscoveryPageViewModel.swift#L157

Struct in question: https://github.com/kickstarter/ios-oss/blob/master/KsApi/models/Project.swift

Will provide more info as we find it!

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 14, 2018

Comment by Justin Swart (JIRA)

Further investigation proved that this is our problematic enum: https://github.com/kickstarter/ios-oss/blob/master/KsApi/lib/Route.swift and breaking it up into smaller enums helped to prevent the crash. Although this does feel like an awkward workaround.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 14, 2018

Awkward indeed. That is extremely valuable information, though!

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Dec 14, 2018

Comment by Justin Swart (JIRA)

Good! Hope it proves useful. Something else I should mention is that although we've been discussing it on this thread, SR-8950 actually seems exactly like the crash we are having.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 17, 2018

Thanks for the pointer. If it is indeed the same problem then that would be great, since it has a simple test case.

@swift-ci
Copy link
Collaborator Author

@swift-ci swift-ci commented Jan 2, 2019

Comment by Michael McGuire (JIRA)

@mikeash Hope you had (are having?) some great time off for the holidays!

A colleague of mine spent some time removing most of the code from our application to create a reproduction we could sent to you. He uploaded it as #46878694 to Bug Reporter. Let me know if there's anything else we can do to help!

@mikeash
Copy link
Contributor

@mikeash mikeash commented Jan 14, 2019

MonocularVision (JIRA User) Thanks! I took some extra time off and am now getting back into things. It looks like that bug got assigned to someone else in the meantime and is working through. I'll keep an eye on it. Having a reproducer should help enormously, thanks very much for doing that. Hopefully we can figure it out.

@mikeash
Copy link
Contributor

@mikeash mikeash commented Jun 29, 2020

Guess I did a poor job of keeping an eye on it. This was fixed in Xcode 10.2.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants