xxfast / KStore

A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and kotlinx.io
https://xxfast.github.io/KStore/
Apache License 2.0
470 stars 15 forks source link

Lock initial read in `onStart` #77

Closed zacharee closed 8 months ago

zacharee commented 8 months ago

The initial read in file/KStore isn't protected by the lock that writes and other reads are. This can lead to a case where an application triggers a write during the initial read, causing the read to get truncated data with larger file sizes.