[SR-11739] [CoreLib] swift_getAssociatedTypeWitnessSlowImpl EXC_BAD_ACCESS #54146
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
run-time crash
Bug → crash: Swift code crashed during execution
Environment
10.15 Beta (19A573a) and 10.15 Release
Xcode 11.1 and Xcode 11.2
iOS 10, 11, 12 on iPhone 8, 8 Plus Simulator but also on iPhone 7 Plus, iPhone 6S
Additional Detail from JIRA
md5: 64355a8390dbdc9db4b30f1f60583a45
Issue Description:
swift_getAssociatedTypeWitnessSlowImpl EXC_BAD_ACCESS when too many Generics / Protocols. Check out this project: https://github.com/mariusjcb/CrossReduxSOA
I'm writing a project in Combine and SwiftUI with backward compatibility for iOS 12/11 with RxSwift, RxCocoa and UIKit. My project is based on a lot of protocols, associated types and generics. When I'm running the project on iOS 13 it works fine but on iOS 12 the app suddenly crash.
I'm trying a Redux architecture with some changes. I have reducers, actions (as enums), stores and store providers (a store provider is intended to instantiate two stores: rxstore <it's like a viewmodel for rxcocoa ui> and a combinestore <it's like a viewmodel for swiftui>. (i know it's not the best way to do that but I would like to understand why the bug occurs).
Also I have a so called ReduxArchiver and a ReduxArchiverElement. This one (ReduxArchiver) is like a listener or a delegate intended to handle and save redux store changes. (also I know it's not the best solution). When a store have a new state the ReduxArchiver handle the change, modify data as needed and decide to save or not the state on disk. Archiver is also intended to load app states from disk when a store is instantiated.
The error is Thread 1: EXC_BAD_ACCESS (code=1, address=0x10) and appears when I'm instantiating an object of ReduxArchiver type. It happens because of the instantiation of ReduxArchiverElement<T: Codable> array (see the code below or here: https://github.com/mariusjcb/CrossReduxSOA )
Sometimes it appears in console:
I don't know if it's my fault or just a swift bug because of too many associated types/generics in the project.
I have both combine and swiftui linked as weak frameworks so there is no problem with missing SwiftUI/Combine.
Also my frameworks and libraries are embedded in target settings as Embed & Sign.
The actual error:
When I'm doing po $arg1:
When I'm examinating the $rdi:
Instantiation of the object:
The EXC_BAD_ACCESS from let defaultStoreArchiver is located in ExampleArchiver<StoreType: ReduceStore> on the line:
ReduxArchiverElement is defined as:
finally the StoreType and Reducer are defined as:
About the actual error the stack looks like:
for #16 0x0000000106375018 in swift_getAssociatedTypeWitness () the actual assembly looks like:
also for #0 0x00000001063746e4 in swift_getWitnessTable () the asm looks like:
The text was updated successfully, but these errors were encountered: