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-16047] iOS 15.4.0 Crash in MetadataAllocator #58308

Closed
swift-ci opened this issue Mar 23, 2022 · 8 comments
Closed

[SR-16047] iOS 15.4.0 Crash in MetadataAllocator #58308

swift-ci opened this issue Mar 23, 2022 · 8 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-16047
Radar None
Original Reporter LeffelMania (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 5
Component/s swift
Labels Bug, RunTimeCrash
Assignee @mikeash
Priority Medium

md5: 0ca327e049dfcd077837218d35cfde86

Issue Description:

We’re experiencing a set of crashes that began affecting all of our iOS releases on March 14, 2022, the day iOS 15.4.0 was released to the public. The crashes begin appearing on the same date in proportional volume to our usage on each live version of our app (see screenshot); March 14th doesn't correlate to our own release dates, so we don't believe the crashes resulted from any changes we made. We also saw that Metadata.cpp has a recent history of changes, which solidified our theory that a bug was shipped in Swift with the release of iOS 15.4.0. We haven't experienced the crash directly and do not have reproduction steps. Two crash logs are attached for reference, each crashing in MetadataAllocator::Allocate(unsigned long, unsigned long).

4 libswiftCore.dylib 0x0000000185f3801c swift::fatalError(unsigned int, char const*, ...) + 140 (Errors.cpp:376)

5 libswiftCore.dylib 0x0000000185f41698 swift::MetadataAllocator::Allocate(unsigned long, unsigned long) + 516 (Metadata.cpp:6106)

6 libswiftCore.dylib 0x0000000185f421f4 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 1004 (Concurrent.h:1210)

We hope this can be addressed in a 15.4.1 of iOS, and we'd be interested in hearing if there may be a workaround to not trigger whatever is causing this condition. I'm happy to provide any additional information that may be helpful.

@swift-ci
Copy link
Collaborator Author

Comment by Maxime Epain (JIRA)

Hey! Looks like it's related to this assertion, @mikeash, could it be?

@mikeash
Copy link
Contributor

mikeash commented Mar 28, 2022

This turned out to be a compiler bug. Fix here: apple/llvm-project#3917

@swift-ci
Copy link
Collaborator Author

Comment by Alex Leffelman (JIRA)

Thanks for your response! I'm not really familiar with release process/timelines for these projects, can you say anything about when/whether that compiler fix will make it into an iOS release? I'm not sure what to expect or if there are any next steps I should take here while waiting for that fix.

(Additional note: In another discussion it was brought to my attention that the iOS binaries for our app were built with Xcode 13.2.1, so if the answer is that the fix has already been released in Xcode 13.3 and we should just recompile with that, that would be excellent news).

@mikeash
Copy link
Contributor

mikeash commented Mar 28, 2022

That fix will be in a future release, but as you suspect I can't say when.

Unfortunately, this compiler bug ends up affecting the Swift runtime, so the compiler you use for your own code doesn't affect it, and using 13.3 won't help.

@mikeash
Copy link
Contributor

mikeash commented Mar 31, 2022

Today's 15.4.1 update includes this fix.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 1, 2022

Comment by Alex Leffelman (JIRA)

Awesome, thanks for the update, @mikeash!

@Luffy19960106
Copy link

are there some action to avoid this crash?I can‘t suggest user to update system when meet this crash in iOS 15.4,and threre are a lot of iOS15.4 users

@AnthonyLatsis
Copy link
Collaborator

I don’t think we have a proper way of dealing with these issues. Theoretically, statically linking the standard library when deploying to iOS 15.4 specifically would solve the issue, but static linking is an all-or-nothing decision as far as I am concerned. I may be wrong.

Alternatively (still ugly though), you could localize the crash, figure out a different way of expressing that code that doesn’t crash, and put it under a dynamic #available check.

This issue was closed.
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. crash Bug: A crash, i.e., an abnormal termination of software run-time crash Bug → crash: Swift code crashed during execution runtime The Swift Runtime
Projects
None yet
Development

No branches or pull requests

4 participants