Skip to content

Commit 2ceabf8

Browse files
jbonofreclaude
andcommitted
apacheGH-1055: Fix flaky TestBasicAuth memory leak by waiting for async buffer release
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. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7cbf159 commit 2ceabf8

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)