Skip to content

Commit

Permalink
HPCC4J-545 Resume read test causes OOM error (#649)
Browse files Browse the repository at this point in the history
- Updated resume read test to periodically run gc

Signed-off-by: James McMullan [email protected]

Signed-off-by: James McMullan [email protected]
  • Loading branch information
jpmcmu authored Oct 13, 2023
1 parent 905b095 commit 80d27a8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<HPCCRecord> resumedRecords = new ArrayList<HPCCRecord>();
for (int i = 0; i < resumeInfo.size(); i++)
{
Expand All @@ -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());
Expand Down

0 comments on commit 80d27a8

Please sign in to comment.