Skip to content

test(host): size fallback reuse bodies past Go 1.27's post-Close drain - #464

Open
ravi-pplx wants to merge 1 commit into
block:mainfrom
perplexityai:test/host-fallback-go127-drain
Open

ravi-pplx wants to merge 1 commit into
block:mainfrom
perplexityai:test/host-fallback-go127-drain

Conversation

@ravi-pplx

@ravi-pplx ravi-pplx commented Nov 22, 2026 •

Copy link
Copy Markdown

TestHostFallbackConnectionReuse/large and /large_chunked fail on Go 1.27:

host_test.go:532: Expected values to be equal:
    -2
    +1

Since Go 1.27, when an unread response body is closed, the net/http Transport drains it in the background (up to 256 KiB, for at most 50 ms) and returns the connection to the idle pool. The 4 KiB bodies in the large cases fit inside that drain, so the fallback request reuses the primary's connection even though the strategy's own 2 KiB drain skips those bodies.

Change

  • The large cases now use 1 MiB bodies, larger than both the strategy's drain and the Transport's. The test still checks that the strategy doesn't keep a connection whose body it won't drain.
  • No production code changes.

Testing

  • The test passes on Go 1.26 and Go 1.27.
  • If the strategy's drain is made unbounded, the large cases fail on both versions.

Created with Perplexity

Signed-off-by: Ravi Agarwal <ravi@perplexity.ai>
Co-authored-by: Perplexity <noreply@perplexity.ai>
@ravi-pplx

Copy link
Copy Markdown
Author

@codex review

Created with Perplexity

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T18:11:33.157361Z 39eaed6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 39eaed6b57

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ravi-pplx
ravi-pplx marked this pull request as ready for review November 22, 2026 18:10
@ravi-pplx
ravi-pplx requested a review from a team as a code owner November 22, 2026 18:10
@ravi-pplx
ravi-pplx requested review from worstell and removed request for a team November 22, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant