symious commented on code in PR #1179:
URL: https://github.com/apache/ratis/pull/1179#discussion_r1865993945


##########
ratis-client/src/main/java/org/apache/ratis/client/impl/DataStreamClientImpl.java:
##########
@@ -153,6 +153,9 @@ private CompletableFuture<DataStreamReply> 
combineHeader(CompletableFuture<DataS
 
     private CompletableFuture<DataStreamReply> writeAsyncImpl(Object data, 
long length, Iterable<WriteOption> options) {
       if (isClosed()) {
+        if (data instanceof ByteBuf) {
+          ((ByteBuf) data).release();
+        }

Review Comment:
   > Can I ask where is this ByteBuf released? 
(https://github.com/apache/ratis/blob/master/ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java#L134)
   
   This one will be released on outbound write.
   
   > The final release I think is for the retain here. 
(https://github.com/apache/ratis/blob/master/ratis-netty/src/main/java/org/apache/ratis/netty/NettyDataStreamUtils.java#L165)
   
   The final release is for the very first initialize of the ByteBuf. The 
`retain` in `decode` will be release after the decode itself.



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