Skip to content

feat(statement): add execution-scoped client query timeout - #339

Merged
cathleeny merged 8 commits into
refactor/split-execution-materializationfrom
feat/client-query-timeout
Sep 22, 2026
Merged

cathleeny merged 8 commits into
refactor/split-execution-materializationfrom
feat/client-query-timeout

Conversation

@cathleeny

@cathleeny cathleeny commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add Statement::execute_with_timeout(Duration) and kernel_statement_execute_with_timeout_ms
  • apply one absolute client deadline to PR refactor(sea): Client query timeout - split query execution from result materialisation #337's execution phase: runtime queueing (C ABI), execute/status RPCs, retries/backoff, poll sleeps, and terminal mapping
  • return Timeout / HYT00 / retryable=false, with the query ID when known; run bounded cancel/close cleanup in the background

Semantics

Call Behavior
Existing Statement::execute / kernel_statement_execute Existing 600s polling ceiling
New timeout API with a finite value One client deadline from entry through terminal mapping
New timeout API with C 0 or Rust Duration::ZERO / Duration::MAX Explicitly unlimited

An absent timeout must use the existing API; it must not be translated to 0. At a finite deadline, no new status poll starts. A status RPC already in flight may finish within five seconds; a terminal result wins during that grace period, otherwise execution returns HYT00.

The client deadline excludes result materialisation/fetching and is never sent to the server. C finite values are capped at 9_223_372_036_854 ms. Async handles and metadata queries remain unchanged at 600s.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --lib (949 passed)
  • timeout wiremock tests (8 passed)
  • C ABI timeout test (1 passed)

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Medium

Solid, well-tested feature. The timeout plumbing, HYT00/retryable=false error contract, background cleanup (defuse + dispatch_timeout_cleanup avoids double-cancel), C-ABI deadline capture, and Duration::ZERO/MAX sentinels all look correct, and the wiremock/C-ABI coverage is thorough. One medium concern: removing the poll_timeout ceiling from wait_for_terminal also un-bounds all metadata queries (which pass None and have no timeout escape hatch), not just the intended execute() path.

Comment thread src/client/sea.rs Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Medium

Solid, well-tested change — the absolute client deadline is applied correctly via timeout_at, the mid-execute cancel guard is defused before dispatching bounded background cleanup (so no double-cancel), and coverage spans Rust/wiremock/C-ABI tiers including reuse and range validation. One medium note: gating the internal poll ceiling on ExecuteMetadataQuery removes the previously-unconditional 600s bound from the default synchronous execute() path, so callers who supply no timeout can now block indefinitely — intentional and documented, but a public-contract change worth confirming.

Comment thread src/client/sea.rs Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — the execution-scoped client timeout is implemented carefully and thoroughly tested. The grace-vs-poll-sleep distinction, post-deadline no-new-poll guard, guard.defuse() + async cleanup handoff (avoiding double-cancel), and preservation of the default/metadata 600s ceiling all check out, with matching wiremock and C ABI coverage. Only one minor convention gap: the new public/ABI surface isn't recorded under the changelog's Added section.

Comment thread NEXT_CHANGELOG.md Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Looks good — the execution-scoped client timeout is implemented carefully and matches the documented semantics (absolute deadline through terminal mapping, no new poll after the deadline, a bounded 5s grace for an in-flight status RPC, materialisation excluded, background cancel/close cleanup). The ExecutionTimeout threading through Transport, metadata queries kept on Default, and the reuse/idempotency behavior are all well covered by the new wiremock and C-ABI tests. One low-severity note on query-id resolution under lock contention posted inline.

Comment thread src/client/sea.rs Resolved
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: 1 Low

Solid, thorough PR — the client-deadline state machine (outer timeout_at, one-shot in-flight status grace, dual deadline checks in wait_for_terminal, terminal-FAILED-wins-during-grace, background bounded cleanup) is logically consistent and well covered by the new wiremock/C-ABI tests. No correctness or lifecycle bug found; default/metadata/async paths correctly retain the 600s ceiling and synchronous cleanup, and the C cap matches the Rust constant. One Low inline note on a swallowed poisoned-lock query-id read. Nits (not filed inline): the query-id extraction block is duplicated at sea.rs:841–844 and 852–855, and the pre-/post-sleep deadline checks in wait_for_terminal are near-identical — both are candidates for a small helper to reduce drift risk."

Comment thread src/client/sea.rs Resolved
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No issues identified by the review bot.

@cathleeny
cathleeny added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit 56e2c9e Sep 22, 2026
23 of 24 checks passed

This branch was previously deployed

1 inactive deployment
azure-prod — 5c1bfcb9 Deployed Sep 17, 2026 by cathleeny via followup #1402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants