Java.lang.outofmemoryerror gc overhead limit exceeded


#1

Hi Team,

We are using aspose slides (aspose-slides 18.6) with spring MVC for creating .pptx files which mainly contains, graphs, charts and images.Each generated pptx file will have around 200 slides.
this works fine for one user. But, when multiple requests comes in, out 5 only 2 will get pptx file generated, others will fail with java.lang.outofmemoryerror gc overhead limit exceeded. . Please help us with the exception and work around to work with concurrent user able to generate pptx files.

ByteArrayOutputStream bos = new ByteArrayOutputStream();

Presentation ppt = null;
Presentation pptUpdated = null;

try{

  AsposeLicense.initiateLicenseForPpt(filePath.toString());

LoadOptions loadOptions = new LoadOptions();
loadOptions.getBlobManagementOptions().setPresentationLockingBehavior(PresentationLockingBehavior.KeepLocked);
ppt = new Presentation(path,loadOptions);

pptUpdated=updatePPTWithData(ppt, reportVO, actualSelObj, criteria); // code to populated data in ppt
pptUpdated.save(bos, SaveFormat.Pptx);
out = response.getOutputStream();
out.write(bos.toByteArray());

}catch(Exception e){
LOGGER.log(Level.ERROR, "Report generation failed : " + e);
e.printStackTrace();
}finally{
try{
ppt.dispose();
pptUpdated.dispose();
out.flush();
out.close();
bos.close();
}catch(Exception exeption){
LOGGER.log(Level.ERROR, exeption);
}
}


#2

@natarajnb,

Can you please share source file so that we may further investigate to help you out. Before sharing requested information can you please try to use latest version of Aspose.Slides.


#3

Below is the complete stack trace for aspose-slides-19.9-jdk16.jar

19-Sep-2019 12:00:00.061 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/beadashboardweb] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded] with root cause
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.AbstractStringBuilder.(AbstractStringBuilder.java:68)
at java.lang.StringBuffer.(StringBuffer.java:139)
at sun.text.normalizer.ReplaceableString.(ReplaceableString.java:64)
at sun.text.normalizer.ReplaceableUCharacterIterator.(ReplaceableUCharacterIterator.java:62)
at sun.text.normalizer.UCharacterIterator.getInstance(UCharacterIterator.java:84)
at sun.text.normalizer.NormalizerBase.setText(NormalizerBase.java:1005)
at java.text.CollationElementIterator.setText(CollationElementIterator.java:510)
at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:389)
at com.aspose.slides.internal.e4.do.if(Unknown Source)
at com.aspose.slides.internal.e4.do.do(Unknown Source)
at com.aspose.slides.ms.System.s.do(Unknown Source)
at com.aspose.slides.internal.nj.long.if(Unknown Source)
at com.aspose.slides.internal.eu.switch.if(Unknown Source)
at com.aspose.slides.internal.mw.a.int(Unknown Source)
at com.aspose.slides.internal.mw.a.for(Unknown Source)
at com.aspose.slides.internal.mw.a.int(Unknown Source)
at com.aspose.slides.internal.mw.char.do(Unknown Source)
at com.aspose.slides.internal.mw.a.if(Unknown Source)
at com.aspose.slides.internal.mw.az.(Unknown Source)
at com.aspose.slides.abl.do(Unknown Source)
at com.aspose.slides.Presentation.if(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.(Unknown Source)
at com.aq.spring.beadashboardweb.util.ReportGeneratorUtilForBrandOverview.createFile(ReportGeneratorUtilForBrandOverview.java:127)
at com.aq.spring.beadashboardweb.controller.ReportGeneratorController.createReport(ReportGeneratorController.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
19-Sep-2019 12:00:00.065 SEVERE [http-nio-8080-exec-9] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/beadashboardweb] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded] with root cause
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.aspose.slides.ParagraphFormatEffectiveData.char(Unknown Source)
at com.aspose.slides.ParagraphFormatEffectiveData.(Unknown Source)
at com.aspose.slides.TextStyleEffectiveData.do(Unknown Source)
at com.aspose.slides.TextStyleEffectiveData.do(Unknown Source)
at com.aspose.slides.TextStyleEffectiveData.if(Unknown Source)
at com.aspose.slides.AccessibleEffectiveData.int(Unknown Source)
at com.aspose.slides.TextStyle.byte(Unknown Source)
at com.aspose.slides.TextStyle.getEffective(Unknown Source)
at com.aspose.slides.ParagraphFormatEffectiveData.do(Unknown Source)
at com.aspose.slides.ParagraphFormatEffectiveData.do(Unknown Source)
at com.aspose.slides.AccessibleEffectiveData.int(Unknown Source)
at com.aspose.slides.ParagraphFormat.break(Unknown Source)
at com.aspose.slides.ajh.do(Unknown Source)
at com.aspose.slides.ajh.catch(Unknown Source)
at com.aspose.slides.ajh.(Unknown Source)
at com.aspose.slides.TextFrame.do(Unknown Source)
at com.aspose.slides.Table.do(Unknown Source)
at com.aspose.slides.Table.byte(Unknown Source)
at com.aspose.slides.Shape.finally(Unknown Source)
at com.aspose.slides.Transform2DPPTXSerialization.do(Unknown Source)
at com.aspose.slides.ou.if(Unknown Source)
at com.aspose.slides.ou.do(Unknown Source)
at com.aspose.slides.aii.do(Unknown Source)
at com.aspose.slides.o3.do(Unknown Source)
at com.aspose.slides.o3.do(Unknown Source)
at com.aspose.slides.a3.do(Unknown Source)
at com.aspose.slides.afp.do(Unknown Source)
at com.aspose.slides.abs.do(Unknown Source)
at com.aspose.slides.abs.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
19-Sep-2019 12:04:13.163 SEVERE [http-nio-8080-exec-2] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/beadashboardweb] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded] with root cause
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.aspose.slides.ms.System.Xml.gy.case(Unknown Source)
at com.aspose.slides.ms.System.Xml.gy.g(Unknown Source)
at com.aspose.slides.ms.System.Xml.gy.e(Unknown Source)
at com.aspose.slides.ms.System.Xml.gy.case(Unknown Source)
at com.aspose.slides.ms.System.Xml.gx.case(Unknown Source)
at com.aspose.slides.internal.mx.g8.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.g8.(Unknown Source)
at com.aspose.slides.internal.mx.hd.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.hd.(Unknown Source)
at com.aspose.slides.internal.mx.ce.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.ce.(Unknown Source)
at com.aspose.slides.internal.mx.ew.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.ew.(Unknown Source)
at com.aspose.slides.internal.mx.ex.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.ex.(Unknown Source)
at com.aspose.slides.internal.mx.apb.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.apb.(Unknown Source)
at com.aspose.slides.internal.mx.apd.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.apd.(Unknown Source)
at com.aspose.slides.internal.mx.aoo.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.aoo.(Unknown Source)
at com.aspose.slides.internal.mx.b0.do(Unknown Source)
at com.aspose.slides.internal.mx.default.if(Unknown Source)
at com.aspose.slides.internal.mx.b0.(Unknown Source)
19-Sep-2019 12:09:30.883 SEVERE [http-nio-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcher] in context with path [/beadashboardweb] threw exception [Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: GC overhead limit exceeded] with root cause
java.lang.OutOfMemoryError: GC overhead limit exceeded


#4

@natarajnb,

I think you are using standard values of jdk. Can you please increase heap memory. This will resolve your issue. If there is still an issue than please share complete environment details source file and complete sample code so that we may further investigate to help you out.


#5

Thanks for your response, can you please suggest the approximate required heap memory for 10 concurrent user with each user generating a pptx of around 200 slides containings graphs,charts and images


#6

@natarajnb,

I have observed your comments. You need atleast 3 GB heap memory to complete the process.


#7

Hi Adnan,

Thanks for your response, we are using tomcat 8.5 with 4GB heap memory , But still we are facing out of memory exception :

20-Sep-2019 12:27:43.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.41
20-Sep-2019 12:27:43.817 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 4 2019 09:17:16 UTC
20-Sep-2019 12:27:43.817 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.41.0
20-Sep-2019 12:27:43.818 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
20-Sep-2019 12:27:43.818 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
20-Sep-2019 12:27:43.818 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
20-Sep-2019 12:27:43.818 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_131\jre
20-Sep-2019 12:27:43.818 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_131-b11
20-Sep-2019 12:27:43.819 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
20-Sep-2019 12:27:43.819 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41
20-Sep-2019 12:27:43.819 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41
20-Sep-2019 12:27:43.819 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41\conf\logging.properties
20-Sep-2019 12:27:43.820 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
20-Sep-2019 12:27:43.820 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms4096m
20-Sep-2019 12:27:43.820 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx4096m
20-Sep-2019 12:27:43.820 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=6144
20-Sep-2019 12:27:43.821 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
20-Sep-2019 12:27:43.827 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
20-Sep-2019 12:27:43.828 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41
20-Sep-2019 12:27:43.831 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41
20-Sep-2019 12:27:43.833 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\tomcat\apache-tomcat-8.5.41\apache-tomcat-8.5.41\temp
20-Sep-2019 12:27:43.836 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_131\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\IntelĀ® Management Engine Components\DAL;C:\Program Files\Intel\IntelĀ® Management Engine Components\DAL;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.8.0_131\bin;D:\apache-maven-3.6.1\bin;C:\Program Files\nodejs;C:\Users\11196\AppData\Local\Microsoft\WindowsApps;C:\Users\11196\AppData\Roaming\npm;.]
20

Please help us on this issue.


#8

@natarajnb,

Can you please provide JAVA_OPTS of Tomcat server that you used on your end.


#9

Hi Adnan,

we have setenv.bat under tomcatinstallation/bin/setenv.bat, below is the configuration we are using.

set JAVA_OPTS=-server -Xmx8096m


#10

@natarajnb,

Can you please share source presentation so that we may investigate further to help you out.


#11

Hi Adnan,

As soon as LoadOptions() start executing we see the spike in the CPU utilization and reaches 100%CPU_Spike_Issue.JPG (86.7 KB)

LoadOptions loadOptions = new LoadOptions();
loadOptions.getBlobManagementOptions()
.setPresentationLockingBehavior(PresentationLockingBehavior.LoadAndRelease);

  	LOGGER.info(" presentation with load options ");
  	ppt = new Presentation(path, loadOptions);
  	LOGGER.info(" presentation with load END ");

Please compare the logger in the above code with the screen shot attached which shows the spike in the Java VisualVM tool.


#12

@natarajnb,

I have observed the issue shared by you and also the details of usage of Aspose.Slides in your very first post. You are using big presentations (with multimedia, chart and tables contents) and having simultaneous requests too. Generally, the OutofMemory exception is thrown in cases where API is not getting required memory. In your case, I suggest you to please try increasing the Java heap size on your end. As far as CPU consumption is concerned, it is dependent on amount of load you put using parallel Spring MVC threads to serve the requests.

If you still feel that we need to investigate this on our end, please provide the working sample project, Operating System/Java and machine details on your end along with source presentation. We will try to replicate the situation on our end on provision of requested information to help you further.