[SR-10107] A single crash when merging Dictionaries #52509
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
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 9bfe22a0f1477eb005026526f6549510
Issue Description:
I got a very weird crash when merging dictionaries, and I couldn't find anything anywhere.
I posted it in the apple forums, and was directed here to see if you guys could maybe find the issue: https://forums.developer.apple.com/message/351321 5
I posted also in swift forums: https://forums.swift.org/t/a-single-crash-when-merging-dictionaries/21511
Have a method that is func getSubscriptions(for group: Group) -> [String: Bool].
And then this line crashes
func getSubscriptions(for groups: [Group]) -> [String: Bool]
{ ----> return groups.compactMap(
{ getSubscriptions(for: $0) }
).reduce([:]) { $0.merging($1)
{ (current, _) in current }
}
}
I have validated that this all occurs only and always on main thread
Group is an object instance, holding basic data
Crash details:
12.1.4 (16D57)
iPhone X
Feb 22, 2019, 6:51:00 PM
Swift 4.0 (NOT 4.2)
Crash info:
Fatal error: Duplicate values for key: '5c6765c3041c69001517afb0': file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_Fall2018/swiftlang_Fall2018-1000.11.42/src/swift/stdlib/public/core/Dictionary.swift, line 3853
Below is the stack trace:
EXC_BREAKPOINT 0x0000000102c7a1ac
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x102c7a1ac hidden#6617 (*hidden#17759:135)
1 libswiftCore.dylib 0x102ae1dd0 assertionFailure first-element-marker first-element-marker fileflags(:::*:🙂 (hidden#17736)
2 MY_APP 0x100c5929c specialized VariantDictionaryBuffer.nativeMerge<A>(:uniquingKeysWith🙂 (<compiler-generated>)
3 MY_APP 0x100c5ae50 specialized Dictionary.init<A>(uniqueKeysWithValues🙂 (<compiler-generated>)
4 MY_APP 0x100c491e8 MyViewController.getSubscriptions(for🙂 (<compiler-generated>)
5 MY_APP 0x100c473c0 MyViewController.updateListUI(shouldReload🙂 (MyViewController.swift:101)
6 MY_APP 0x100c5751c closure #1 in MyViewController.applyFilters(_🙂 (<compiler-generated>)
7 MY_APP 0x100b939e0 thunk for @escaping @callee_guaranteed () -> () (<compiler-generated>)
8 libdispatch.dylib 0x194ff96c8 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x194ffa484 _dispatch_client_callout + 16
10 libdispatch.dylib 0x194fd9b34 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 1012
11 CoreFoundation 0x195551ce4 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
12 CoreFoundation 0x19554cbac __CFRunLoopRun + 1964
13 CoreFoundation 0x19554c0e0 CFRunLoopRunSpecific + 436
14 GraphicsServices 0x1977c5584 GSEventRunModal + 100
15 UIKitCore 0x1c279cc00 UIApplicationMain + 212
The text was updated successfully, but these errors were encountered: