apache / apache/shenyu

[BUG] NonCommittingMcpResponseDecorator never releases collected DataBuffers (pooled buffer leak)

Open Beginner friendly
#6,643 1 comment 0 reactions 0 assignees View on GitHub
feature: plugin priority: high type: bug
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/NonCommittingMcpResponseDecorator.java:146-156`
- description: `aggregateDataBuffers` reads bytes from each `DataBuffer` via `buffer.read(bytes)` but never calls `DataBufferUtils.release(buffer)`. The `collectList()` collects all buffers; after processing they should be released. Since this is a "non-committing" decorator (doesn't write to underlying response), the buffers are never consumed by a downstream writer.
- impact: Pooled direct-memory leak proportional to response size on every Streamable HTTP tool call.
- suggested_fix: Release each buffer after reading in `aggregateDataBuffers`, or use `DataBufferUtils.releaseConsumer`.
- confidence: High
- related_existing: none

---
_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

Open shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/response/NonCommittingMcpResponseDecorator.java around lines 146-156 and inspect aggregateDataBuffers. Verify how collected DataBuffers are handled after their bytes are read; done means the non-committing response no longer leaks pooled buffers and the relevant project tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.