Skip to content

Conversation

@duongkame
Copy link
Contributor

@duongkame duongkame commented Jan 23, 2024

What changes were proposed in this pull request?

When running tests as per #1023, some buffer leaks are discovered.

  1. The ReferenceCountedObject release in whenComplete (e.g. RaftServerImpl's submitClientRequestAsync and appendEntriesAsync) does not always guarantee an execution. As the retuned future may be discarded when the client connection is terminated.
  2. The processClientRequest called from SlidingWindow doesn't always guarantee 100% execution either. PendingOrderedRequest entries may not be processed at all because of client cancellation, or request duplications (IllegalStateException due to retries.
  3. LogEntryProto loaded from files is not released after being retained. This is harmless for now but is noisy in leak detection mode.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/RATIS-2007

How was this patch tested?

Tests.

@duongkame duongkame marked this pull request as ready for review January 24, 2024 01:37
@duongkame
Copy link
Contributor Author

@szetszwo Please have a look.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@duongkame , thanks for working on this! Just have a comment inlined.

Comment on lines 885 to 886
final RaftClientReply reply = newExceptionReply(request, e);
requestRef.release();
final RaftClientReply reply = newExceptionReply(request, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original order (newExceptionReply -> release) seems better since request is used in newExceptionReply.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I made that change my mistake.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the change looks good.

@szetszwo szetszwo merged commit e2aaddc into apache:master Jan 25, 2024
symious pushed a commit to symious/ratis that referenced this pull request Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants