Skip to content

Commit

Permalink
Check specifically for stale file handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
akolov committed Nov 20, 2024
1 parent cdb7835 commit 8e1a657
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/duckdb-server-rust/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ where
match query_fn(state, params.clone()).await {
Ok(response) => return Ok(response),
Err(AppError::Error(err)) => {
if let Some(duckdb::Error::DuckDBFailure(ffi_error, _)) = err.downcast_ref::<duckdb::Error>() {
if attempt <= max_retries {
if let Some(duckdb::Error::DuckDBFailure(_, _)) = err.downcast_ref::<duckdb::Error>() {
if err.to_string().to_lowercase().contains("stale file handle") && attempt <= max_retries {
tracing::warn!(
"DuckDB failure encountered: {}. Retrying after recreating connection. Attempt: {}",
err,
attempt
);
tracing::warn!("FFI Error is {:?}", ffi_error);
state.recreate_db(database_id).await?;
continue;
}
Expand Down

0 comments on commit 8e1a657

Please sign in to comment.