From dcbc104c99ed66e1aa648fdb0726e32331b00a09 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 5 Apr 2026 03:22:41 -0400 Subject: [PATCH] fix(store): keep shared slatedb open across run handles After the single-DB refactor, closing one SlateRunStore could close the shared SlateDB for every run in the process. Under shared-daemon test load that surfaced as 500 responses with \"db is closed\" on later state, event, and delete requests. Make run-handle close a no-op so the shared DB lifetime stays owned by the store/process rather than individual run handles. --- lib/crates/fabro-store/src/slate/run_store.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/crates/fabro-store/src/slate/run_store.rs b/lib/crates/fabro-store/src/slate/run_store.rs index ddbc78e19..6192fb7b2 100644 --- a/lib/crates/fabro-store/src/slate/run_store.rs +++ b/lib/crates/fabro-store/src/slate/run_store.rs @@ -6,7 +6,7 @@ use bytes::Bytes; use chrono::Utc; use futures::Stream; use serde::de::DeserializeOwned; -use slatedb::{CloseReason, Db, DbRead, ErrorKind}; +use slatedb::{Db, DbRead}; use tokio::sync::{Mutex, broadcast, mpsc}; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -117,15 +117,7 @@ impl SlateRunStore { pub(crate) async fn close(&self) -> Result<()> { let _guard = self.inner.close_lock.lock().await; - if Arc::strong_count(&self.inner) <= 1 { - match self.inner.db.close().await { - Ok(()) => Ok(()), - Err(err) if matches!(err.kind(), ErrorKind::Closed(CloseReason::Clean)) => Ok(()), - Err(err) => Err(err.into()), - } - } else { - Ok(()) - } + Ok(()) } pub(crate) async fn validate_init(db: &R, run_id: &RunId) -> Result