When running a benchmark with multiple concurrent connections, I get a crash in TableInfo.getInfo(), where codableMap["\(type)"] is being force-unwrapped:
The code should have ensured it was initialized if it was initially nil, however if multiple threads execute this for the same type, we can end up unwrapping a nil value.
The assignment of this map should be made thread-safe.
Environment Details
Information about your OS, Swift version and Xcode version if on macOS.
Context and Description
When running a benchmark with multiple concurrent connections, I get a crash in
TableInfo.getInfo()
, wherecodableMap["\(type)"]
is being force-unwrapped:https://github.com/IBM-Swift/Swift-Kuery-ORM/blob/master/Sources/SwiftKueryORM/TableInfo.swift#L37
The code should have ensured it was initialized if it was initially nil, however if multiple threads execute this for the same type, we can end up unwrapping a nil value.
The assignment of this map should be made thread-safe.
Environment Details
Information about your OS, Swift version and Xcode version if on macOS.
Steps to Reproduce
1) ... 2) ...
Expected vs. Actual Behaviour