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

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 15f50796b MINOR: Fix flaky TestBasicAuth memory leak by waiting for 
async buffer release (#1058)
15f50796b is described below

commit 15f50796b5603100702560fad4b4c843f4fa379c
Author: JB Onofré <[email protected]>
AuthorDate: Mon Mar 9 15:12:41 2026 +0100

    MINOR: Fix flaky TestBasicAuth memory leak by waiting for async buffer 
release (#1058)
    
    ## What's Changed
    
    gRPC/Netty releases Arrow buffers asynchronously after server shutdown.
    Poll briefly for the allocator's memory to drain before closing it,
    preventing spurious "Memory was leaked" errors in CI.
    
    The fix adds a brief polling loop to wait for the allocator's memory to
    drain before closing it.
---
 .../src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/flight/flight-core/src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java
 
b/flight/flight-core/src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java
index 0c63785c8..0f202ba2d 100644
--- 
a/flight/flight-core/src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java
+++ 
b/flight/flight-core/src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java
@@ -178,6 +178,12 @@ public class TestBasicAuth {
     AutoCloseables.close(server);
 
     allocator.getChildAllocators().forEach(BufferAllocator::close);
+
+    // gRPC/Netty may still be releasing Arrow buffers asynchronously after 
server shutdown.
+    // Poll briefly to allow in-flight buffer releases to complete before 
closing the allocator.
+    for (int i = 0; i < 20 && allocator.getAllocatedMemory() > 0; i++) {
+      Thread.sleep(100);
+    }
     AutoCloseables.close(allocator);
   }
 }

Reply via email to