Closed DJ-LEE11 closed 10 months ago
Yeah, that's definitely an issue with the LRU Cache. How often does it happen? Do you have a way to reproduce it regularly?
It's not thread safe: see: https://github.com/apollographql/apollo-kotlin/pull/2878 https://github.com/apollographql/apollo-kotlin/issues/2844
looks like using https://github.com/ReactiveCircus/cache4k could be a solution?
This crash happened by chance. Our current solution is to use Ktor provide thread-safe ConcurrentMap to replace LinkedHashMap.
Making sure we use the same coroutineContext
when loading a cached resource might be the issue. Idk have to look into it more.
but then again I don't think using a suspend there would be ideal 🤔
https://github.com/touchlab/Stately is another option
try 0.9.0
lmk if you have any problems. I switch it to being backed by stately's ConcurrentMutableMap
Affected platforms
Versions
Crash Info
Occurrence location
LinkedHashMap is thread-unsafe.