Skip to content

[SR-10546] Runtime crash while iterating through collection of Decodable structs w/ URL fields #52946

Closed
@swift-ci

Description

@swift-ci
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareregressionrun-time crashBug → crash: Swift code crashed during executionswift 5.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions