From d09fdc8c7ee1e3e2df106258d832c1ca6b2f0fde Mon Sep 17 00:00:00 2001 From: Vladislav Kuzmin <67874880+principalwater@users.noreply.github.com> Date: Fri, 20 Nov 2026 17:35:52 +0300 Subject: [PATCH] fix(database): clarify the JDBC cancellation timeout (#4749) When a JDBC statement misses the cancellation deadline the session is closed; the error now says to check the statement's status on the server before running it again and that the next query reconnects on its own, instead of asking for a manual reconnect. Closes #4742 Co-authored-by: principalwater <67874880+principalwater@users.noreply.github.com> --- crates/ide-db/src/jdbc/mod.rs | 4 +++- crates/ide-db/tests/jdbc.rs | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/ide-db/src/jdbc/mod.rs b/crates/ide-db/src/jdbc/mod.rs index 2dc6db27f..8e973fb7f 100644 --- a/crates/ide-db/src/jdbc/mod.rs +++ b/crates/ide-db/src/jdbc/mod.rs @@ -303,7 +303,9 @@ async fn read_frame(output: &mut (impl AsyncRead + Unpin)) -> IdeResult> const CANCEL_GRACE: Duration = Duration::from_secs(3); fn cancel_timeout() -> IdeError { - IdeError::invalid("The JDBC driver did not stop in time. The session was closed. Reconnect to continue.") + IdeError::invalid( + "Cancellation timed out and the JDBC session was closed. Check the statement's status on the server before running it again. The next query will try to reconnect.", + ) } async fn exchange( diff --git a/crates/ide-db/tests/jdbc.rs b/crates/ide-db/tests/jdbc.rs index a7827a299..29387948e 100644 --- a/crates/ide-db/tests/jdbc.rs +++ b/crates/ide-db/tests/jdbc.rs @@ -210,9 +210,13 @@ async fn unresponsive_driver_closes_before_reconnect() -> IdeResult<()> { }) .await .expect("driver cancellation must be bounded"); - assert!(result.unwrap_err().message.contains("Reconnect")); - db.disconnect("test").await; - assert_eq!(db.execute("test", "after reconnect", 1, &normal).await?.affected, Some(1.0)); + assert_eq!( + result.unwrap_err().message, + "Cancellation timed out and the JDBC session was closed. Check the statement's status on the server before running it again. The next query will try to reconnect." + ); + assert!(db.connected().is_empty()); + assert_eq!(db.execute("test", "after cancellation", 1, &normal).await?.affected, Some(1.0)); + assert_eq!(db.connected(), ["test"]); db.disconnect("test").await; Ok(()) }