Skip to content

Commit

Permalink
HPCC4J-545 Resume read test causes OOM error
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]
  • Loading branch information
jpmcmu committed Oct 13, 2023
1 parent acc0ecb commit 734de55
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 734de55

Please sign in to comment.