[SR-10546] Runtime crash while iterating through collection of Decodable structs w/ URL fields #52946
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
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
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
frame install Foundation via the ninja script and add the test phase for Foundation #4: 0x00000001040c0040 StructIterationCrasher`@objc NotificationStreamImportOperation.main() at <compiler-generated>:0
frame Only run bindings-build-record on OS X due to test flakiness on Liunx… #5: 0x000000019ecdb7e8 Foundation`-[__NSOperationInternal _start:] + 748
frame Debug Info: Don't reset the debug scope after leaving the outermost s… #6: 0x00000001040ccbe8 StructIterationCrasher`closure Redundant Load Elimination Patches #1 in closure Remove unnecessary
unsafeUnwrap
calls. #2 in AppDelegate.application(self=0x00000001098348a0) at AppDelegate.swift:190:32frame Fix a bug in SILValue's hoistAddressProjections #7: 0x00000001040cbdcc StructIterationCrasher`thunk for @escaping @callee_guaranteed () -> () at <compiler-generated>:0
frame Simplify configure pass for Foundation to use a defined variable for XCTest's build directory #8: 0x00000001a0fead40 CoreData`developerSubmittedBlockToNSManagedObjectContextPerform + 164
frame update related projects list to include Foundation and XCTest #9: 0x0000000104607be4 libclang_rt.asan_ios_dynamic.dylib`asan_dispatch_call_block_and_release + 316
frame Remove the FunctionEnumeration data structure from CalleeAnalysis #10: 0x0000000105c901dc libdispatch.dylib`_dispatch_client_callout + 20
frame Alias analysis cleanups #11: 0x0000000105c98310 libdispatch.dylib`_dispatch_lane_serial_drain + 708
frame Add support to create xctoolchain with code sign #12: 0x0000000105c99014 libdispatch.dylib`_dispatch_lane_invoke + 420
frame Use typed boxes to simplify capture representation in SILGen #13: 0x0000000105ca2c18 libdispatch.dylib`_dispatch_workloop_worker_thread + 1168
frame Reduce memory footprint of the Swift compiler #14: 0x000000019df3fb38 libsystem_pthread.dylib`_pthread_wqthread + 316
frame Remove conditional compilation of tvOS #15: 0x000000019df45dec libsystem_pthread.dylib`start_wqthread + 4
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.
The text was updated successfully, but these errors were encountered: