Skip to content

Commit 15f5079

Browse files
authored
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.
1 parent 7cbf159 commit 15f5079

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

flight/flight-core/src/test/java/org/apache/arrow/flight/auth/TestBasicAuth.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ public static void shutdown() throws Exception {
178178
AutoCloseables.close(server);
179179

180180
allocator.getChildAllocators().forEach(BufferAllocator::close);
181+
182+
// gRPC/Netty may still be releasing Arrow buffers asynchronously after server shutdown.
183+
// Poll briefly to allow in-flight buffer releases to complete before closing the allocator.
184+
for (int i = 0; i < 20 && allocator.getAllocatedMemory() > 0; i++) {
185+
Thread.sleep(100);
186+
}
181187
AutoCloseables.close(allocator);
182188
}
183189
}

0 commit comments

Comments
 (0)