From cd8588e0909fd6b0f458fb0c3d47ab676e01d672 Mon Sep 17 00:00:00 2001 From: JayLiu <38887641+luky116@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:28:02 +0800 Subject: [PATCH] fix:Reclaim the heartbeat response message to avoid memory leakage of GettyRemoting.futures (#665) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:回收心跳response消息,以避免GettyRemoting.futures内存泄露 * remove chinese comment --------- Co-authored-by: tanzegen <39859116+tanzegen@users.noreply.github.com> Co-authored-by: Xin Wang --- pkg/remoting/processor/client/client_heart_beat_processon.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/remoting/processor/client/client_heart_beat_processon.go b/pkg/remoting/processor/client/client_heart_beat_processon.go index 0ba2f58cf..c3822c54a 100644 --- a/pkg/remoting/processor/client/client_heart_beat_processon.go +++ b/pkg/remoting/processor/client/client_heart_beat_processon.go @@ -38,5 +38,9 @@ func (f *clientHeartBeatProcessor) Process(ctx context.Context, rpcMessage messa log.Debug("received PONG from {}", ctx) } } + msgFuture := getty.GetGettyRemotingInstance().GetMessageFuture(rpcMessage.ID) + if msgFuture != nil { + getty.GetGettyRemotingInstance().RemoveMessageFuture(rpcMessage.ID) + } return nil }