You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P0][bug] cancel is JS-counter only; no KILL QUERY; ARCHITECTURE §5.2 cancel_query unimplemented #281
ARCHITECTURE §5.2 describes cancel_query, KILL QUERY <thread_id>, and event-streamed cancellation. DESIGN_REQUIREMENTS §FR-2.2.4 acceptance: "Stop button and Ctrl+. cancels the currently executing query; sends KILL QUERY to the server".
Problem
resultStore.cancelActiveQuery increments a local generation counter, which only stops the client from accepting more rows. The server-side query continues running until completion or natural timeout. A user who cancels a SELECT SLEEP(60) sees the spinner stop, but SHOW PROCESSLIST on the server shows the query still running for the full 60s. No KILL QUERY is sent, no CONNECTION_ID() is captured, no cancel_query IPC exists.
Files
src/stores/resultStore.ts (esp. cancel via generation counter)
src-tauri/crates/mas-core/src/query/executor.rs (no per-statement cancellation)
src-tauri/src/commands/mod.rs (no cancel_query command)
While spinner is gone within ~1s, SHOW PROCESSLIST from another session shows SELECT SLEEP(60) still running for the original session.
Expected
Clicking Cancel sends KILL QUERY <connection_id> to MySQL within 500ms; the query returns an error, the connection stays usable for the next statement.
Proposed fix
Scope L. Backend: track MySqlConnection per query, on cancel spawn tokio::spawn to execute KILL QUERY CONNECTION_ID() on a sibling connection. Expose as new cancel_query(query_handle) Tauri command. Frontend: cancelActiveQuery dispatches based on the in-flight handle. Land integration test test_cancel_long_query from TESTING_STRATEGY §4.
Acceptance
SELECT SLEEP(60) is killed within 2s of Cancel. Connection is reusable. Test passes.
Fixed by #420 (and the surrounding work in that campaign). Cancel is no longer a JS counter.
cancel_query is a registered Tauri command; the executor tracks the in-flight thread id per connection and kill_query sends KILL QUERY <thread> to the server. resultStore.ts calls it, with the comment recording exactly the point this issue makes:
// Bumping the generation only makes this client ignore the response. The// statement keeps running — and holding locks — until the server is told to// stop, which is what cancelQuery does (#420).
The timeout path does the same before reporting, so an abandoned statement is not left running.
Not auto-closed because that PR referenced the issue without a closing keyword.
Activity
EVWorth commentedon Sep 8, 2026
Fixed by #420 (and the surrounding work in that campaign). Cancel is no longer a JS counter.
cancel_queryis a registered Tauri command; the executor tracks the in-flight thread id per connection andkill_querysendsKILL QUERY <thread>to the server. resultStore.ts calls it, with the comment recording exactly the point this issue makes:The timeout path does the same before reporting, so an abandoned statement is not left running.
Not auto-closed because that PR referenced the issue without a closing keyword.