From 734de557ada359f8d95301f1303334ab2466d7cb Mon Sep 17 00:00:00 2001 From: James McMullan Date: Fri, 13 Oct 2023 09:23:48 -0400 Subject: [PATCH] HPCC4J-545 Resume read test causes OOM error - Updated resume read test to periodically run gc Signed-off-by: James McMullan James.McMullan@lexisnexis.com --- .../java/org/hpccsystems/dfs/client/DFSReadWriteTest.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java b/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java index 2fc59c86d..02b1581f7 100644 --- a/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java +++ b/dfsclient/src/test/java/org/hpccsystems/dfs/client/DFSReadWriteTest.java @@ -178,6 +178,7 @@ public void readResumeTest() throws Exception System.out.println("Messages from file part (" + i + ") read operation:\n" + fileReader.getRemoteReadMessages()); } + Runtime runtime = Runtime.getRuntime(); ArrayList resumedRecords = new ArrayList(); for (int i = 0; i < resumeInfo.size(); i++) { @@ -194,6 +195,13 @@ public void readResumeTest() throws Exception resumedRecords.add(record); } + + // Periodically run garbage collector to prevent buffers in remote file readers from exhausting free memory + // This is only needed due to rapidly creating / destroying thousands of HpccRemoteFileReaders + if ((i % 10) == 0) + { + runtime.gc(); + } } assertEquals("Number of records did not match during read resume.", records.size(), resumedRecords.size());