Abhishek Pal created RATIS-2631:
-----------------------------------
Summary: Netty data-stream shutdown does not drain in-flight
streams
Key: RATIS-2631
URL: https://issues.apache.org/jira/browse/RATIS-2631
Project: Ratis
Issue Type: Bug
Reporter: Abhishek Pal
Assignee: Abhishek Pal
On shutdown, `DataStreamManagement.shutdown()` and
`NettyServerStreamRpc.close()` only stop the request/write executor thread
pools. Streams still in flight, tracked in the [streams
map|https://github.com/apache/ratis/blob/a1bbf47f98a83d3bbddb4357c8a9b96bcfd7c727/ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java#L226]
are never drained, so their open DataStream resources and retained
DataStreamRequestByteBuf are not released.
Possible impact:
- Direct (off-heap) memory leak from unreleased pooled DataStreamRequestByteBuf
/ sliced buffers on every stop or restart.
- Leaked StreamInfo entries leave underlying DataStream resources unclosed (for
example open file channels).
- Cumulative leak across repeated restarts can drive OutOfDirectMemoryError or
exhaustion in long-lived JVMs.
- Clients with in-flight streams at shutdown may hang until timeout instead of
failing fast.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)