Where exactly (which line) does the crash occur ?
var marketMap = [String: SomeMarket].init(minimumCapacity: markets.count)
and
marketMap[market.symbol] = market
there are two cases occurred according to callstack from firebase,
Post
Replies
Boosts
Views
Activity
The code you have shown cannot be a proof that your issue is not a multithreading problem.
Especially, using Promise makes me feel that your issue is a multithreading problem. Anyway, if you have any clues about what might be causing your issue other than multithreading, it is your decision on which possibility you put high priority. Thanks for your advice we'll inspect code more carefully
typically, multithreading issue always crash with EXC_BAC_ACCESS, but EXC_BREAKPOINT in this context
Another issue with no multithreading issue definitely
libswiftCore.dylib
swift_slowAlloc.cold.1 + 16
1
libswiftCore.dylib
swift_slowAlloc + 208
2
libswiftCore.dylib
swift_allocObject + 52
3
libswiftCore.dylib
static _DictionaryStorage.allocate(scale:age:seed:) + 152
4
libswiftCore.dylib
Dictionary.init(minimumCapacity:) + 72
func fetchContent() -> Promise<SomeContent> {
Service.getMarketsV2().map { markets in
var marketMap = [String: SomeMarket].init(minimumCapacity: markets.count)
for market in markets where !market.parentMarket.isEmpty {
marketMap[market.symbol] = market
}
return SomeContent(marketMap: marketMap, markets: markets)
}
}
here is the code
for event in events {
		try outputContent?.marketMap[event.symbol]?.update(with: event)
}