Home
Analytics
RunAndRenderTask - OutOfMemory error
richardc
Hi,
I am getting an OOM exception when running the code below (using BIRT runtime version 2_3_2_2).
Note: The code works ok for small reports (under 1000 lines of XML) but gets the OOM part way in of running a report which has 14000 lines of XML and is comprised of several subreports and is designed to output to pdf.
I am running this code in Eclipse and have configured the eclipse.ini file with -Xms1024m -Xmx1024m but without success.
I also tested running the same report using a command line batch file instead (based on the file genReport.bat which comes with the BIRT runtime) - I used -Xms1640m -Xmx1640m but got the same exception
Can you please advise?
Is there a way to temporarily write to the hard drive to relieve some memory?
Java Code
EngineConfig config = new EngineConfig();
config.setEngineHome(REPORT_ENGINE_HOME);
ReportEngine reportEngine = new ReportEngine(config);
IReportRunnable report = null;
report = reportEngine.openReportDesign(REPORT_TEMPLATES_HOME + "" + reportName + ".rptdesign");
ReportUtils.parseParams(reportEngine, report, reportParams);
// Create a task to run the report and convert the output to Excel or PDF.
IRunAndRenderTask task = reportEngine.createRunAndRenderTask(report);
if("pdf".equals(format)){
PDFRenderOption pdfOption = new PDFRenderOption(); pdfOption.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
String output = reportName.replaceFirst("_pdf", "") + "." + format;
pdfOption.setOutputFileName(GENERATED_REPORTS_HOME + "" + jobID + "" + output);
task.setRenderOption(pdfOption);
} else if("xls".equals(format)){
RenderOption excelOption = new RenderOption();
excelOption.setOutputFormat(format);
String output = reportName.replaceFirst("_xls", "") + "." + format;
excelOption.setOutputFileName(GENERATED_REPORTS_HOME + "" + jobID + "" + output);
task.setRenderOption(excelOption);
}
// Run the report.
task.run();
Exception:
09/10/2009 2:48:34 PM org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
SEVERE: An OutOfMemory error happened while running the report.
Exception in thread "Thread-0" java.lang.OutOfMemoryError: Java heap space
at org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromInputStream$LocalCache.<init>(XMLSourceFromInputStream.java:91)
at org.eclipse.datatools.enablement.oda.xml.util.XMLSourceFromInputStream.openInputStream(XMLSourceFromInputStream.java:55)
at org.eclipse.datatools.enablement.oda.xml.util.SaxParser.<init>(SaxParser.java:81)
at org.eclipse.datatools.enablement.oda.xml.util.SaxParserNestedQueryHelper.<init>(SaxParserNestedQueryHelper.java:65)
at org.eclipse.datatools.enablement.oda.xml.util.SaxParserConsumer.<init>(SaxParserConsumer.java:105)
at org.eclipse.datatools.enablement.oda.xml.impl.ResultSet.next(ResultSet.java:144)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaResultSet.next(OdaResultSet.java:177)
at org.eclipse.birt.data.engine.odaconsumer.ResultSet.fetch(ResultSet.java:139)
at org.eclipse.birt.data.engine.executor.cache.OdiAdapter.fetch(OdiAdapter.java:145)
at org.eclipse.birt.data.engine.executor.cache.RowResultSet.next(RowResultSet.java:102)
at org.eclipse.birt.data.engine.executor.cache.ExpandableRowResultSet.next(ExpandableRowResultSet.java:64)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.populateData(SmartCacheHelper.java:313)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initInstance(SmartCacheHelper.java:285)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initOdaResult(SmartCacheHelper.java:155)
at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.getResultSetCache(SmartCacheHelper.java:79)
at org.eclipse.birt.data.engine.executor.cache.SmartCache.<init>(SmartCache.java:57)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.populateOdiResultSet(PassUtil.java:99)
at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.pass(PassUtil.java:62)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSetCacheInResultSetPopulator(PassManager.java:321)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.doPopulation(PassManager.java:275)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.doMultiPass(PassManager.java:227)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassManager.java:93)
at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateResultSet(PassManager.java:70)
at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:196)
at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init>(CachedResultSet.java:86)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSourceQuery.java:741)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:331)
at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:945)
at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:233)
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:160)
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:109)
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:137)
Find more posts tagged with
Comments
bak
<Update>
BIRT 2.x does have a cache for the BIRT handled rows, search for "DiskCache". Our data source which reads COBOL flat files read the file at once on open, returning a row from the file at each fetch. This generates the OOM exception, not BIRT: It was our fault ;-)
</Update>
We have the same problem: Reports - in our cases mostly large tables - can span 400000 rows and we get constantly OutOfMemory exception.
How can we stream the output to disc like Jasper Reports can do it?