Java Heap Space error when exporting to Excel in XLSX format

0
Hello,   I have more than 10K row data to be exported in XLSX format. I am receiving a Java Heap Space error in GenerateExcelDoc javaaction of ExcelExporter(XLSReport) module when I try to export all the data in XLSX format. If I change the file type to CSV in Export template, 10K data is successfully exported. It also exports successfully when the number of rows are reduced.  I would appreciate the help…   Kind Regards       11/11/2022, 8:50:57.000 AM,"CRITICAL - ActionManager: Error in execution of monitored action '{""name"":""Main.Act_ExportDeliverables"",""type"":""Microflow""}' (execution id: ace825ab-cd3b-4d9d-9ddd-a1ff9d6a0242, execution type: CLIENT_ASYNC_MONITORED)"11/11/2022, 8:50:57.000 AM,"CRITICAL - ActionManager: java.lang.OutOfMemoryError: Java heap space"11/11/2022, 8:50:57.000 AM,"Exception in thread ""ActionManager-1"" java.lang.OutOfMemoryError: Java heap space"11/11/2022, 8:50:57.000 AM,"ERROR - Connector: com.mendix.systemwideinterfaces.MendixRuntimeException: org.eclipse.jetty.io.EofException"11/11/2022, 8:50:57.000 AM,"Caused by: org.eclipse.jetty.io.EofException: null"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpConnection$SendCallback.reset(HttpConnection.java:735)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpConnection$SendCallback.access$300(HttpConnection.java:694)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:553)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:1009)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:1086)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpOutput.channelWrite(HttpOutput.java:285)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpOutput.close(HttpOutput.java:638)"11/11/2022, 8:50:57.000 AM," at java.base/sun.nio.cs.StreamEncoder.implClose(Unknown Source)"11/11/2022, 8:50:57.000 AM," at java.base/sun.nio.cs.StreamEncoder.close(Unknown Source)"11/11/2022, 8:50:57.000 AM," at java.base/java.io.OutputStreamWriter.close(Unknown Source)"11/11/2022, 8:50:57.000 AM," at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.close(WriterBasedJsonGenerator.java:1004)"11/11/2022, 8:50:57.000 AM," at com.mendix.webui.jsonserialization.JsonGeneratorWrapper.$anonfun$close$1(JsonGeneratorWrapper.scala:25)"11/11/2022, 8:50:57.000 AM," at com.mendix.webui.jsonserialization.JsonGeneratorWrapper.$anonfun$close$1$adapted(JsonGeneratorWrapper.scala:25)"11/11/2022, 8:50:57.000 AM," at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)"11/11/2022, 8:50:57.000 AM," at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)"11/11/2022, 8:50:57.000 AM," at scala.collection.AbstractIterable.foreach(Iterable.scala:926)"11/11/2022, 8:50:57.000 AM," at com.mendix.webui.jsonserialization.JsonGeneratorWrapper.close(JsonGeneratorWrapper.scala:25)"11/11/2022, 8:50:57.000 AM," at com.mendix.webui.jsonserialization.ResultSerializer.close(ResultSerializer.scala:21)"11/11/2022, 8:50:57.000 AM," at com.mendix.webui.requesthandling.ClientRequestHandler.processRequest(ClientRequestHandler.scala:80)"11/11/2022, 8:50:57.000 AM," at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:37)"11/11/2022, 8:50:57.000 AM," at com.mendix.external.connector.MxRuntimeConnector.$anonfun$processRequest$1(MxRuntimeConnector.scala:50)"11/11/2022, 8:50:57.000 AM," at com.mendix.external.connector.MxRuntimeConnector.$anonfun$processRequest$1$adapted(MxRuntimeConnector.scala:50)"11/11/2022, 8:50:57.000 AM," at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.scala:50)"11/11/2022, 8:50:57.000 AM," at com.mendix.basis.impl.MxRuntimeImpl.processRequest(MxRuntimeImpl.scala:221)"11/11/2022, 8:50:57.000 AM," at com.mendix.m2ee.appcontainer.server.handler.RuntimeServlet.service(RuntimeServlet.scala:25)"11/11/2022, 8:50:57.000 AM," at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:230)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.Server.handle(Server.java:516)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)"11/11/2022, 8:50:57.000 AM," at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)"    
asked
2 answers
0

This is due to the nature of the exports, they are created differently.

While the xlsx export tries to create the file in memory and then write the file, the csv export batches the data writes to the file which reduces the memory footprint.

The only way to export this amount of data is increasing the available memory, or create the xlsx export in batches reducing the number of records in a single file or use the csv export with excel hints turned on and opening the csv in excel.

answered
0

Hi Hamza,

 

Use Asynchronous type in microflow settings, it will reduce heap memory usage.

answered