fix(ttstream): ttstream should not recycle connection when Recv Timeout with DisableCancelRemote=true#1934
Closed
DMwangnima wants to merge 1 commit into
Closed
Conversation
4813494 to
72fb453
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1934 +/- ##
==========================================
+ Coverage 61.37% 61.94% +0.56%
==========================================
Files 388 391 +3
Lines 35063 30182 -4881
==========================================
- Hits 21521 18695 -2826
+ Misses 12247 10202 -2045
+ Partials 1295 1285 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
acd91df to
3696079
Compare
338bd94 to
4fda48f
Compare
…fix ttstream connection reuse Previously, RecvMsg created a child context from the stream ctx for recv timeout. This coupled stream-level timeout with per-recv timeout, causing incorrect behavior: - When DisableCancelRemote=true, stream ctx expiration was misidentified as recv timeout, preventing the RST frame from being sent and breaking connection reuse. - When stream ctx expired before recv timeout, the error was reported as recv timeout instead of stream timeout. Changes: - Redesign Pipe to support two-level ctx: a pipe-level ctx (stream lifecycle) and a per-read ctx (individual recv timeout), each with its own callback - Separate stream timeout (error 12015) from recv timeout (error 12014) so they trigger independent close/cancel logic - Fix Pipe.ReadCtx to drain remaining items after detecting closed state, preventing data loss in Write+Close race - Move container package to internal to prevent external dependency - Update streaming interface comments to accurately describe client/server side RecvMsg/SendMsg semantics and error caching behavior
4fda48f to
aca6d89
Compare
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.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
Bug 触发场景
客户端使用 TTStream 进行流式 RPC 调用,配置 RecvTimeout + DisableCancelRemote=true 时触发。
触发原因
当 Recv 超时触发后,ctxDoneCallback 会被触发,执行 s.close 关闭 Stream,并复用 Stream 对应的连接。
但当 DisableCancelRemote=true 时,这个 Stream 的生命周期不应该结束,直接复用会导致一个连接上出现两个 Stream 的数据,违背了一个连接一个 Stream 的原则。
(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: