fix: make thrift transport fallback pool-aware#654
Open
shenyj3 wants to merge 3 commits into
Open
Conversation
Preserve buffered reads before surfacing stream errors, close cancelled shmipc RPC streams, and prevent failed streams from returning to the pool. Refresh the polling-to-eventfd dependency revision.
shenyj3
force-pushed
the
agent/shmipc-transport-fallback
branch
from
July 14, 2026 19:14
42ba042 to
5a275a0
Compare
shenyj3
marked this pull request as ready for review
July 14, 2026 19:18
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
==========================================
+ Coverage 46.20% 48.42% +2.22%
==========================================
Files 163 164 +1
Lines 20307 20691 +384
==========================================
+ Hits 9382 10019 +637
+ Misses 10925 10672 -253 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shmipc0.2 tofeature/polling-to-eventfdatc2747ce9Root cause
The previous make-transport wrapper could dial a fallback address after the outer connection pool had already selected the primary address as its key. A successful UDS fallback could therefore be stored under the shmipc key, making later requests stick to the wrong transport.
The pingpong path also recycled shmipc streams after failed calls. A failed send can leave unsent bytes in the stream buffer, while cancellation can drop the RPC future before normal recycling runs; either case can leave an unusable stream available for a later request. Separately,
BufReadercould poll the underlying stream even while it still held response bytes, allowing a close/error to hide an already-buffered TTHeader frame.Impact
Fallback transports are pooled under the address that was actually dialed. Completed buffered responses remain readable when the peer closes immediately afterward, and failed or cancelled shmipc streams are closed instead of being leaked or reused.
Validation
cargo +nightly fmt --all -- --checkcargo +nightly clippy -p volo-thrift --no-default-features --features shmipc,multiplex -- --deny warningscargo +nightly test -p volo-thrift --features shmipc,multiplex(36 passed)cargo +nightly test -p volo --features shmipc(22 passed, 1 ignored)中文说明
变更概述
shmipc0.2 更新到feature/polling-to-eventfd分支的c2747ce9根因
旧的 make-transport wrapper 可能在外层连接池已经选定主地址作为连接池键之后,才改为拨号 fallback 地址。因此,成功建立的 UDS fallback 连接可能被存入 shmipc 地址对应的连接池项,导致后续请求持续复用错误的传输类型。
此外,pingpong 路径会在调用失败后仍然回收 shmipc 流。发送失败可能在发送缓冲区中留下未发送数据,而请求取消会在正常回收逻辑执行前直接丢弃 RPC future;这两种情况都会让不可用的流留给后续请求复用。另一方面,
BufReader在内部仍有响应数据时也可能继续轮询底层流,使连接关闭或错误掩盖已经缓冲的完整 TTHeader 帧。影响
fallback transport 现在会按实际拨号地址进入对应连接池。即使对端在发送完成后立即关闭连接,已缓冲的完整响应仍可正常读取;失败或取消的 shmipc 流会被关闭,不再泄漏或被后续请求复用。
验证
cargo +nightly fmt --all -- --checkcargo +nightly clippy -p volo-thrift --no-default-features --features shmipc,multiplex -- --deny warningscargo +nightly test -p volo-thrift --features shmipc,multiplex(36 个测试通过)cargo +nightly test -p volo --features shmipc(22 个测试通过,1 个忽略)