More details here: https://bugzilla.mozilla.org/show_bug.cgi?id=1807010#c2
rkv's safe mode protects the in-memory database contents with an RwLock (
|
pub(crate) fn dbs_mut(&self) -> Result<RwLockWriteGuard<EnvironmentDbs>, ErrorImpl> { |
|
self.dbs.write().map_err(|_| ErrorImpl::EnvPoisonError) |
|
} |
), but that lock is released in
, before flushing the contents to disk. So, even if (2) weren't a factor, multiple calls to EnvironmentImpl.write_to_disk() from different task queues could still race with each other.
I wonder we can mitigate this issue by adding a separate lock solely for this write_to_disk() and wait for the lock for each write.
More details here: https://bugzilla.mozilla.org/show_bug.cgi?id=1807010#c2
I wonder we can mitigate this issue by adding a separate lock solely for this
write_to_disk()and wait for the lock for each write.