This is an automated email from the ASF dual-hosted git repository.

zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 2bcaf9edb [#1462] fix(server): Memory may leak when flushQueue is full 
(#1463)
2bcaf9edb is described below

commit 2bcaf9edb30b9763449c9dd16865d4e34440ff12
Author: RickyMa <[email protected]>
AuthorDate: Fri Jan 19 10:59:57 2024 +0800

    [#1462] fix(server): Memory may leak when flushQueue is full (#1463)
    
    ### What changes were proposed in this pull request?
    
    Release the memory when a flush event is dropped.
    
    ### Why are the changes needed?
    
    For [#1462](https://github.com/apache/incubator-uniffle/issues/1462)
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing UTs.
---
 .../main/java/org/apache/uniffle/server/DefaultFlushEventHandler.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/server/src/main/java/org/apache/uniffle/server/DefaultFlushEventHandler.java 
b/server/src/main/java/org/apache/uniffle/server/DefaultFlushEventHandler.java
index d9f6cde1f..1d4f43ca5 100644
--- 
a/server/src/main/java/org/apache/uniffle/server/DefaultFlushEventHandler.java
+++ 
b/server/src/main/java/org/apache/uniffle/server/DefaultFlushEventHandler.java
@@ -69,6 +69,9 @@ public class DefaultFlushEventHandler implements 
FlushEventHandler {
   public void handle(ShuffleDataFlushEvent event) {
     if (!flushQueue.offer(event)) {
       LOG.error("Flush queue is full, discard event: " + event);
+      // We need to release the memory when discarding the event
+      event.doCleanup();
+      ShuffleServerMetrics.counterTotalDroppedEventNum.inc();
     } else {
       ShuffleServerMetrics.gaugeEventQueueSize.inc();
     }

Reply via email to