feat(sdk): support client-level and per-request timeouts (default: not timeout -> 30 s)#3429
feat(sdk): support client-level and per-request timeouts (default: not timeout -> 30 s)#3429chengxilo wants to merge 13 commits into
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
8b9a947 to
005b84e
Compare
|
/ready |
3c5bfab to
b08a9a2
Compare
|
/author |
|
After merging there is something need to be changed. |
|
/ready |
There was a problem hiding this comment.
a few findings that don't map onto changed lines:
- the consumer poll loop error classifier (
consumer.rs) only treatsDisconnected | Unauthenticated | StaleClientas connection errors, so aRequestTimeout(andNotConnected) falls through as a raw error withcan_pollleft true and no backoff, on every transport. this is the real root of the quic no-recovery behavior noted in the quic comment. consumer.rs isn't touched by this PR so flagging it here. - the PR description says default 300s but the code is 30s everywhere (a later commit reduced it). update the description.
- no test for the
is_zero()no-timeout branch, nor for the vsr session-reset-on-timeout path. - the timeout is rust-sdk only; java/.net/python/go/c++/node don't get it - worth filing parity issues later on
df904fa to
605a84b
Compare
- Acquire stream lock outside timeout region to avoid counting lock-wait time against the request budget - Emit DiagnosticEvent::Disconnected and null stream/connection on timeout for all transports (TCP, QUIC, WebSocket) - Preserve client_id on VSR session reset after timeout - Classify RequestTimeout as a connection error in consumer poll loop - Wire request_timeout into HTTP transport via reqwest timeout - Add request_timeout to HTTP connection string options - Add IggyDuration::is_zero() and document zero-timeout behavior - Add timeout and zero-timeout tests for TCP, WebSocket, HTTP - Add VSR session-reset-on-timeout tests for TCP and WebSocket
|
I thought I can make the commit history more clean so I used rebase + force push. But it doesn't end up well so I have to note it here. The changes after the second code review start from fix(sdk): address code review feedback for per-request timeout. I added a per-request level timeout in feat(sdk): provide per-request timeout to override the client level one. I think we should also provide it so the caller can have a better control over their request. The way we can use the per-request level is client.ping().with_timeout(IggyDuration::from_str("10ms").unwrap()) |
|
/ready |
Which issue does this PR address?
Closes #3419
Rationale
Clients had no deadline on individual request, so a stalled server could block a caller forever.
What changed?
send_rawwould be blocked forever if server doesn't response. I added a request_timeout field (IggyDuration, default 30 s) to TcpClientConfig, QuicClientConfig, and WebSocketClientConfig. Each client'ssend_rawnow wraps its I/O intokio::time::timeoutUse client level timeout
Use the per-request level is
Local Execution
AI Usage
YesCan I?Change Log
By default, Iggy Rust SDK would have a 30s timeout for each request.