Aias00 opened a new issue, #6572:
URL: https://github.com/apache/shenyu/issues/6572

   ## Description
   Per proxied request: line 62 builds `new HttpHeaders(request.getHeaders())` 
(full copy) and applies `duplicateHeaders(...)` on it, but the line 67 
`.headers(...)` lambda re-reads `exchange.getRequest().getHeaders()` and 
`addAll`s the raw, un-deduplicated request headers — the deduplicated 
`httpHeaders` from line 62 is never wired into the outbound request. So the 
request-side dedup is ineffective AND there's a wasted full `HttpHeaders` copy 
per request. The response side (97-100) also builds an intermediate 
`HttpHeaders` then `putAll`s into the exchange response (a second copy).
   
   ## Location
   ```
   shenyu-plugin-httpclient/.../WebClientPlugin.java:62-67 (request side), 
97-100 (response side)
   ```
   
   ## Impact
   ~4 `LinkedHashMap`-backed `HttpHeaders` allocations + ~40 entry 
re-insertions per request (for ~10 headers). Single most impactful GC fix on 
the proxy hot path; also a latent correctness concern (request-side 
`REQ_UNIQUE_HEADER` dedup has no effect).
   
   ## Suggested fix
   Pass the line-62 `httpHeaders` into the lambda instead of re-reading 
`exchange.getRequest().getHeaders()`; for the response, write directly into 
`exchange.getResponse().getHeaders()` instead of allocating an intermediate 
`HttpHeaders`.
   
   ## Related existing issue(s)
   None
   
   _Identified during the 2026-08-02 audit; full list in 
[`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to