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-10546] Runtime crash while iterating through collection of Decodable structs w/ URL fields #52946

Closed
swift-ci opened this issue Apr 25, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 5.0

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-10546
Radar rdar://problem/50207580
Original Reporter djs-code (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS 10.14.4 (18E226)

Xcode 10.2.1 (10E1001)

Swift 4.2 / 5.0

iOS Simulator 12.2

iPhone XS w/ iOS 12.0 (16A366)

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

md5: 646ddc117720b95cfdf9b2a4aebb06cb

Issue Description:

When synchronizing our Core Data state with the server, we employ an O(n+m) algorithm leveraging iterators to perform the necessary insert/update/delete operations. However, as-of updating to Xcode 10.2.1, we're now seeing a consistent crash during one of these upsert operations:

* thread #5, queue = 'NSManagedObjectContext 0x10ac2d900', stop reason = EXC_BAD_ACCESS (code=1, address=0x54c0000b0)
frame #0: 0x000000019d54b6f0 libobjc.A.dylib`objc_retain + 16
frame #1: 0x00000001055112d4 libswiftCore.dylib`swift::metadataimpl::ValueWitnesses<swift::metadataimpl::ObjCRetainableBox>::initializeWithCopy(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) + 28
frame #2: 0x00000001040bebb4 StructIterationCrasher`outlined init with copy of (offset: Int, element: AppDelegate.NotificationStreamPayload.Item)? at <compiler-generated>:0

From experimenting with this, it seems that the given payload's URL field is what's triggering this, as omitting it seemingly resolves the issue.

A sample project has been attached.

@aschwaighofer
Copy link
Contributor

This does not reproduce with a recent Xcode.

@swift-ci
Copy link
Contributor Author

Comment by August S. Freytag (JIRA)

For any future investigators, I triggered this issue when adding a computed property `var ids: Set<UUID>` to a store-like class; if you'd try to iterate over the contents of the store with that property in place, you'd get a `swift::metadataimpl::ValueWitnesses` execution fault inside the `Array` iteration. Renaming the property without making any other changes resolved this, so I'm suspecting a collision of sorts under the hood.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 5.0
Projects
None yet
Development

No branches or pull requests

3 participants