Points and query calls that hit the client timeout are sent a second time

未关闭
#320 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust

调研方向

Start by reading ChannelPool::with_channel and its retry conditions, then trace how tonic exposes TimeoutExpired through the status source chain. Reproduce the timeout with the supplied listener setup and inspect the retry tests; the issue says a small PR with a test is ready, so check that work before starting. Done means the timed-out request is sent once, the channel is dropped, and a later call reconnects.

由索引模型根据 Issue 内容生成。

描述

ChannelPool::with_channel retries a failed call once, on a new channel, when the status code is Internal, Unavailable, Cancelled or Unknown and the caller allows retries. All points calls (with_points_client), the root client and the serverless collections client allow retries.

tonic reports an expired client-side timeout (QdrantConfig::timeout) as Code::Cancelled with the message "Timeout expired", and keeps tonic::TimeoutExpired in the status source chain. So a request that already used its whole timeout is sent again with a fresh timeout:

  • the call returns after about 2x timeout, plus the reconnect time (up to connect_timeout);
  • the server gets the same request twice, at a moment when it is already too slow to answer once.

Reproduction: a local TCP listener that accepts connections and never answers, and a client built with .timeout(Duration::from_secs(1)), sending client.query(QueryPointsBuilder::new("c").query(vec![0.5_f32; 16384])) on current dev (48f9098):

query with timeout(1s): failed after 2.11s, bytes received per connection: [65763, 65746], err: Error in the response: The operation was cancelled Timeout expired

About 64 KiB of the request arrived on each of the two connections. If the retry is skipped for TimeoutExpired, the same call fails after 1.11s with one connection ([65763]).

The retry was added to recover from broken channels ("retry api call if channel is broken", and the "domain name change" comment in with_channel). A request that ran into its own timeout is not necessarily a broken channel. I'd suggest not retrying in that case, while still dropping the channel so the next call reconnects. The tradeoff: if the connection died silently, the first call fails with the timeout instead of being retried, and the next call reconnects. I have a small PR with a test ready.

AI-assisted.

主要语言
Rust
星标
425
派生
89
平均合并
2 小时 48 分钟
30 天内合并 PR
3

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

qdrant/rust-client 的其他 Issue

查看 qdrant/rust-client 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。