From 3ab3ebf354105da8f997c6e45c8ebd6cd9074089 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 17 Aug 2023 19:02:29 +0200 Subject: [PATCH] Explicit funlock --- src/db.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/db.rs b/src/db.rs index 88b92fc1..ed80d553 100644 --- a/src/db.rs +++ b/src/db.rs @@ -151,7 +151,7 @@ struct DbInner { next_reindex: AtomicU64, bg_err: Mutex>>, db_version: u32, - _lock_file: std::fs::File, + lock_file: std::fs::File, } #[derive(Debug)] @@ -233,7 +233,7 @@ impl DbInner { last_enacted: AtomicU64::new(last_enacted), bg_err: Mutex::new(None), db_version: metadata.version, - _lock_file: lock_file, + lock_file, }) } @@ -1251,6 +1251,9 @@ impl Db { if let Err(e) = self.inner.kill_logs() { log::warn!(target: "parity-db", "Shutdown error: {:?}", e); } + if let Err(e) = self.inner.lock_file.unlock() { + log::debug!(target: "parity-db", "Error removing file lock: {:?}", e); + } } }