Search before asking
Fluss version
main (development)
Please describe the bug 馃悶
Scanning a primary-key table without a limit through TableScan.createBatchScanner() leaks the network buffers held by ScanKvResponse, even when all results are consumed and the scanner is closed normally.
Four paths reproduce the leak:
- An empty terminal response.
- A response containing a business error.
- Closing the scanner after an in-flight response has completed but before it is consumed.
- A successful response to the close-scanner request.
In deterministic reproductions using serialized and parsed responses, the underlying ByteBuf.refCnt() remains at 1 instead of reaching 0.
ScanKvResponse is lazily parsed, so the RPC layer transfers buffer ownership to its consumer, including for responses without records. KvBatchScanner currently does not release these buffers.
Solution
Release consumed responses in finally, release unconsumed responses through a completion callback when closing, and release close-scanner responses.
The pending future should remain uncancelled so that a late response can still reach the cleanup callback.
Are you willing to submit a PR?
Search before asking
Fluss version
main (development)
Please describe the bug 馃悶
Scanning a primary-key table without a limit through
TableScan.createBatchScanner()leaks the network buffers held byScanKvResponse, even when all results are consumed and the scanner is closed normally.Four paths reproduce the leak:
In deterministic reproductions using serialized and parsed responses, the underlying
ByteBuf.refCnt()remains at 1 instead of reaching 0.ScanKvResponseis lazily parsed, so the RPC layer transfers buffer ownership to its consumer, including for responses without records.KvBatchScannercurrently does not release these buffers.Solution
Release consumed responses in
finally, release unconsumed responses through a completion callback when closing, and release close-scanner responses.The pending future should remain uncancelled so that a late response can still reach the cleanup callback.
Are you willing to submit a PR?