[ 
https://issues.apache.org/jira/browse/RATIS-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17811589#comment-17811589
 ] 

Duong commented on RATIS-2007:
------------------------------

Got it. Closed this and filing new jira. 

> Zero-copy buffers are not released
> ----------------------------------
>
>                 Key: RATIS-2007
>                 URL: https://issues.apache.org/jira/browse/RATIS-2007
>             Project: Ratis
>          Issue Type: Sub-task
>          Components: server
>            Reporter: Duong
>            Assignee: Duong
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Found this bug when working on adding assertions to ensure all zero-copy 
> buffers are released in tests (RATIS-1978).
> When client connections are terminated, the `whenComplete` promise seems not 
> executed. This leads to unreleased zero-copy buffers. For example, the 
> whenComplete block as below may not be executed when clients time out. 
> {code:java}
> // In RaftServerImpl
> @Override
> public CompletableFuture<RaftClientReply> submitClientRequestAsync(
>     ReferenceCountedObject<RaftClientRequest> requestRef) {
>   final RaftClientRequest request = requestRef.retain();
>   ...
>   return replyFuture(requestRef).whenComplete((clientReply, exception) -> {
>   requestRef.release();
>   timerContext.ifPresent(Timekeeper.Context::stop);
>   if (exception != null || clientReply.getException() != null) {
>     raftServerMetrics.incFailedRequestCount(request.getType());
>   }
> }); {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to