fix: cannot rewind body after connection loss error#65873
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b8770a477
ℹ️ 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".
|
|
||
| // Buffering req.Body so that HTTP/2 transport can retry | ||
| if req.Body != nil && req.Body != http.NoBody { | ||
| bodyBytes, err := io.ReadAll(req.Body) |
There was a problem hiding this comment.
Avoid buffering entire request body in catchAll
catchAll is the fallback path for non-special Kubernetes routes, and this new io.ReadAll(req.Body) forces full in-memory buffering before forwarding instead of streaming. For large or streaming request bodies (for example, proxied aggregated API/service endpoints), this can significantly increase latency and memory usage, and allows a single authenticated large upload to consume substantial heap on the proxy. This should be bounded or gated so retries don’t require unbounded buffering for every request body.
Useful? React with 👍 / 👎.
A fix to prevent "net/http: cannot rewind body after connection loss" errors for #65611