[BUG] ShenyuMcpResponseDecorator.writeAndFlushWith does not capture body — streamed responses never complete future
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: High
- files: `shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/response/ShenyuMcpResponseDecorator.java:83-86`
- description: `writeAndFlushWith` delegates straight to `super.writeAndFlushWith(body)` without reading/capturing the stream. For chunked/streamed upstream responses, `responseFuture` is never completed, so `ShenyuToolCallback.call` blocks on `responseFuture.get(60s)` and then throws timeout.
- impact: Tool calls against chunked/streamed upstreams always time out (60s) and return an error to the MCP client.
- suggested_fix: Capture data in `writeAndFlushWith` the same way as `writeWith`, then complete the future on completion.
- confidence: High
- related_existing: none — #6134 (multi-tool timeout) is a different root cause.
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/00-consolidated-critical-high.md`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/response/ShenyuMcpResponseDecorator.java at lines 83-86, and compare writeAndFlushWith with writeWith. Trace how ShenyuToolCallback.call waits on responseFuture.get(60s). Done means streamed or chunked responses capture their body, complete the future, and no longer time out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100