From 03eeb6d1f2c99f433f7d2092bc31924c9e6d1294 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 2 Dec 2026 23:49:08 +0000 Subject: [PATCH] test(rust): isolate deferred SQL read timeout from submission latency (#5372) The macOS 15 Rust job on `main` (`c3f005f7`) failed in `sql_read_timeout_is_per_query_and_cancels_deferred_execution`. The query's 100 ms read timeout expired during Flight submission with `SQL query submission timed out`, before result consumption began. [Failing job](https://github.com/lancedb/lancedb/actions/runs/46756444853/job/143033346699) Use a blocking task to keep paused Tokio time fixed while the real loopback submission completes. Resume the clock before reading results so the test still checks the 100 ms result timeout, deferred Flight cancellation, and a successful second query with the connection defaults. [Related reader fixture](https://github.com/lancedb/lancedb/pull/5000) On Linux, a temporary 300 ms wall-clock delay in the initial Flight `DoGet` reproduced the submission timeout on the original path. The repaired fixture passed the same result-read and cancellation assertions with the delay in place. --- rust/lancedb/src/remote/sql_test.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rust/lancedb/src/remote/sql_test.rs b/rust/lancedb/src/remote/sql_test.rs index 46029f56d..add2711db 100644 --- a/rust/lancedb/src/remote/sql_test.rs +++ b/rust/lancedb/src/remote/sql_test.rs @@ -5668,7 +5668,19 @@ async fn sql_read_timeout_is_per_query_and_cancels_deferred_execution() { let (client, _shutdown) = start_sql_service(service, ClientConfig::default()).await; let mut request = ExecuteQueryRequest::new("SELECT slow get"); request.options.read_timeout = Some(Duration::from_millis(100)); - let query = client.execute(request).await.unwrap(); + + // A blocking task keeps Tokio's paused clock from auto-advancing while + // Flight submission waits on loopback I/O. + tokio::time::pause(); + let submission_client = client.clone(); + let query = tokio::task::spawn_blocking(move || { + tokio::runtime::Handle::current().block_on(submission_client.execute(request)) + }) + .await + .unwrap() + .unwrap(); + tokio::time::resume(); + let error = collect_result(&query).await.unwrap_err(); assert!( error.to_string().contains("SQL result read timed out"),