Repository navigation
feat(statement): enforce timeout across async polling - #374
Conversation
There was a problem hiding this comment.
Verdict: 1 Medium · 1 Low
Solid, well-tested addition — the deadline plumbing, HYT00/query-id contract, and grace-window logic are sound. One medium concern: post-timeout status polls re-dispatch server cancel/close cleanup on every call because dispatch_timeout_cleanup isn't idempotent (telemetry finalize is). One low note on the submit-path expiry not scheduling cleanup, diverging from the header's documented contract.
ea0e91b to
7ae87d2
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — the timeout enforcement is correctly threaded through submit and both async poll paths. One monotonic deadline is retained on the handle, poll paths check it with a bounded status grace, client_query_timeout_error carries Timeout/HYT00/query-id, telemetry finalize is idempotent, and cleanup dispatch is guarded by the client_timeout_expired swap so cancel/close fires at most once; cancel guards are defused on every expiry return to avoid a double-cancel. All three ExecutedAsyncStatement constructors were updated for the new client_deadline arg. Only a minor test-coverage gap (F1) and one cosmetic note. Nit: the as_ref()→as_mut() change at src/c_abi/statement.rs:959 is benign but unnecessary — the status handler only takes a *const reborrow of handle.exec and ExecutedAsyncStatement::status() takes &self, so no exclusive borrow is required.
Addresses: - #4150147368 at src/c_abi/statement.rs:941 - #4150250700 at tests/v0_c_abi_canceller_wiremock.rs:210 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Medium · 1 Low
Solid, well-documented change; the deadline-policy mapping mirrors the sync path and is unit-tested. Two concerns: status() keeps enforcing the deadline even after a terminal status was already observed (returns a spurious Timeout and schedules cancel/close on a finished query — F1, medium), and the new await_result() deadline branches lack any test coverage (F2, low). Nit: the kernel_statement_submit prologue error messages were shortened from kernel_statement_submit: ... to statement submit: ..., dropping the exact entry-point name from the diagnostic — minor, no action needed.
Addresses: - #4161264557 at src/statement/executed_async.rs:490 - #4161264563 at src/statement/executed_async.rs:604 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Medium
Solid, well-tested PR — the deadline-policy mapping, cleanup latching, and telemetry idempotency all check out. One medium concern: await_result() omits the terminal_observed deadline exemption that status() applies, so it can mask an already-finished statement with a spurious Timeout/HYT00 and fire a wasted cancel/close.
There was a problem hiding this comment.
Verdict: 1 Low
Solid, well-tested change — no correctness or convention concerns. The async deadline enforcement faithfully mirrors the sync wait_for_terminal gating (verified at src/client/sea.rs:550), telemetry finalize and cleanup dispatch are idempotent, and the C-ABI boundary matches the documented header contract. One low: the mid-submit timeout_at branch (distinct behavior: None query id, deliberately leaked statement) lacks test coverage, unlike its symmetric hung-status-poll counterpart.
Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
Addresses: - #4150147368 at src/c_abi/statement.rs:941 - #4150250700 at tests/v0_c_abi_canceller_wiremock.rs:210 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4160807790 at src/statement/mutable.rs:555 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161027160 at src/statement/executed_async.rs:250 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161140038 at src/c_abi/statement.rs:959 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161264557 at src/statement/executed_async.rs:490 - #4161264563 at src/statement/executed_async.rs:604 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161264563 at src/statement/executed_async.rs:634 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161406588 at src/statement/executed_async.rs:634 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Addresses: - #4161511147 at src/statement/mutable.rs:497 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
Signed-off-by: Jay Xiao <jay.xiao@databricks.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — the client-timeout-across-async-polling change is correct and well-tested. One low note on the breadth of the new crate-wide clippy::double_must_use allow. The deadline policy mirrors the sync gating, all timeout exits defuse the cancel guard, cleanup dispatch and telemetry finalize are both idempotent, and the terminal-observed latch correctly scopes the deadline to the pre-terminal window; mid-submit expiry's lack of a targetable id is inherent and clearly documented.
| // `async_trait` marks its generated boxed futures as `must_use`. Rust 1.99's | ||
| // `double_must_use` lint also sees the `Future` trait's own annotation, so all | ||
| // async trait methods otherwise fail Clippy despite having the intended | ||
| // must-use behavior. |
There was a problem hiding this comment.
🔵 Low — This crate-level inner attribute suppresses clippy::double_must_use across the entire crate, not just the async_trait-generated methods the comment describes. The explanation is sound for the async-trait false positive, but a crate-wide blanket allow will also silence any genuine future double-#[must_use] on non-async-trait items. Consider scoping it more narrowly (e.g. on the trait definitions / modules that actually trip the lint) so legitimate occurrences elsewhere still surface. Non-blocking — the allow is documented and defensible given how pervasively async_trait is used here.
There was a problem hiding this comment.
Keeping the crate-level #![allow(clippy::double_must_use)] as-is (src/lib.rs:21). The double_must_use false positive is triggered by #[async_trait], which is applied to 18+ trait definitions spread across ~12 modules (src/config.rs, src/client/{sea,transport}.rs, src/statement/{handle,executed,executed_async}.rs, src/reader/** including mod.rs, inline/streaming.rs, cloudfetch/*, post_processor/mod.rs, src/metadata/thrift_shape.rs, src/telemetry/statement.rs). Scoping the allow per-trait/per-module would mean scattering the same attribute across all of those sites — a much larger and more fragile diff than the single documented crate-level allow, and it would have to be re-added each time a new async trait is introduced. The risk the comment flags (silencing a genuine future double-#[must_use]) is low: the crate has no legitimate double-must_use items today, and this is a Rust 1.99 lint interaction with async_trait's generated code rather than something we'd want to catch on our own items. Given the reviewer flagged this as Low/non-blocking and "defensible," I'm leaving the broad allow in place with its explanatory comment.
There was a problem hiding this comment.
Fair points on the maintenance cost — scattering the attribute across 18+ async traits in a dozen modules, and re-adding it per new trait, is a real downside, and I agree the risk of masking a genuine double-#[must_use] is low today. Since no code change was made and the crate-wide allow remains in place, I'll leave this open rather than auto-resolve: it's a Low/non-blocking tradeoff that a human can close with a glance. If a future must_use item on a non-async-trait type ever does get silently swallowed, this thread is the breadcrumb back to the decision. No further action needed from your side.
There was a problem hiding this comment.
⛔ NEEDS HUMAN DECISION — the bots can't resolve this thread; a maintainer's input is required.
Thread has converged: reviewer flagged the crate-wide #![allow(clippy::double_must_use)] as Low/non-blocking, accepted the maintenance-cost rationale for not scoping it per-trait across 18+ async traits in ~12 modules, agreed the masking risk is low today, and explicitly stated no further action is needed — leaving it open deliberately as a breadcrumb for a human to close. No code change is warranted and no live question remains, so flagging for human close rather than continuing the exchange.
Summary
Statement::submit_with_timeout(Duration)insrc/statement/mutable.rswhile preserving existingsubmit()behaviorExecutedAsyncStatementacrossstatus()andawait_result()pollingkernel_statement_submit_with_timeout_msas a thin duration-conversion adapter over the Rust APITimeout/HYT00with query ID and schedule bounded best-effort cancel/close cleanup on expiryScope
The deadline covers initial submit through observed terminal status. Result materialization and fetching remain outside the query-execution timeout, matching synchronous execution. Zero and
Duration::MAXexplicitly mean unlimited.Tests
cargo +stable fmt --allcargo clippy --all-targets -- -D warningscargo test