A single crash when merging Dictionaries


(Shachar Silbert) #1

Hi,

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

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

Any ideas? Below is the stack trace:

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>)


(Suyash Srijan) #2

Could you please file a bug on bugs.swift.org, along with the full code that crashes?


(Shachar Silbert) #3

Have done so, cannot post all the code, it does not belong to me.
https://bugs.swift.org/browse/SR-10107

Just to add, also found this crash info key:
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