Skip to content

fix(ttstream): ttstream should not recycle connection when Recv timeout with DisableCancelRemote=true#1952

Merged
DMwangnima merged 1 commit into
cloudwego:mainfrom
DMwangnima:fix/ttstream-disable-cancel-remote
Apr 24, 2026
Merged

fix(ttstream): ttstream should not recycle connection when Recv timeout with DisableCancelRemote=true#1952
DMwangnima merged 1 commit into
cloudwego:mainfrom
DMwangnima:fix/ttstream-disable-cancel-remote

Conversation

@DMwangnima
Copy link
Copy Markdown
Contributor

@DMwangnima DMwangnima commented Apr 23, 2026

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:

  • Separate RecvTimeout (per-Recv deadline, code 12014) from StreamTimeout (stream ctx deadline, code 12015)
    so that a recv timeout with DisableCancelRemote=true does not close the stream or recycle the connection
  • Add canRetry mechanism to Exception: when DisableCancelRemote=true, recv timeout errors are marked retryable
    and streamReader does not persist the error, allowing subsequent Recv calls to continue
  • Refactor Pipe: bind ctx and callback at construction time, add ReadCtx for per-read ctx/callback,
    remove Cancel()/pipeStateCanceled, move container package to internal
  • RecvMsg now uses context.Background() to derive recv timeout ctx, making it independent from stream ctx
    zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@DMwangnima DMwangnima requested review from a team as code owners April 23, 2026 12:31
@DMwangnima DMwangnima force-pushed the fix/ttstream-disable-cancel-remote branch from a773ee9 to 4333920 Compare April 23, 2026 12:33
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 95.97315% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.84%. Comparing base (bfa27f3) to head (b2405e4).
⚠️ Report is 47 commits behind head on main.

Files with missing lines Patch % Lines
...g/remote/trans/ttstream/internal/container/pipe.go 90.32% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1952      +/-   ##
==========================================
+ Coverage   61.37%   62.84%   +1.46%     
==========================================
  Files         388      394       +6     
  Lines       35063    30267    -4796     
==========================================
- Hits        21521    19020    -2501     
+ Misses      12247     9950    -2297     
- Partials     1295     1297       +2     
Flag Coverage Δ
integration 51.70% <79.19%> (+1.19%) ⬆️
unit 53.37% <93.95%> (+1.73%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DMwangnima DMwangnima force-pushed the fix/ttstream-disable-cancel-remote branch 4 times, most recently from b1233f1 to 44971cb Compare April 24, 2026 02:18
Comment thread pkg/remote/trans/nphttp2/conn_pool_test.go
Comment thread pkg/remote/trans/ttstream/stream_reader.go
@DMwangnima DMwangnima force-pushed the fix/ttstream-disable-cancel-remote branch 2 times, most recently from d8d6f38 to 28d99c2 Compare April 24, 2026 03:14
…ction recycling when DisableCancelRemote=true

- Separate RecvTimeout (per-Recv deadline, code 12014) from StreamTimeout (stream ctx deadline, code 12015)
  so that a recv timeout with DisableCancelRemote=true does not close the stream or recycle the connection
- Add canRetry mechanism to Exception: when DisableCancelRemote=true, recv timeout errors are marked retryable
  and streamReader does not persist the error, allowing subsequent Recv calls to continue
- Refactor Pipe: bind ctx and callback at construction time, add ReadCtx for per-read ctx/callback,
  remove Cancel()/pipeStateCanceled, move container package to internal
- RecvMsg now uses context.Background() to derive recv timeout ctx, making it independent from stream ctx
@DMwangnima DMwangnima force-pushed the fix/ttstream-disable-cancel-remote branch from 28d99c2 to b2405e4 Compare April 24, 2026 03:38
@DMwangnima DMwangnima merged commit e4e1622 into cloudwego:main Apr 24, 2026
24 of 25 checks passed
@DMwangnima DMwangnima deleted the fix/ttstream-disable-cancel-remote branch April 24, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants