Message Boards

java.lang.OutOfMemoryError: GC overhead limit exceeded

thumbnail
Naresh Reddy Kallamadi, modified 5 Years ago.

java.lang.OutOfMemoryError: GC overhead limit exceeded

Regular Member Posts: 120 Join Date: 7/9/14 Recent Posts
Hi All,

I am keep on getting  java.lang.OutOfMemoryError: GC overhead limit exceeded when I treid to deploy plugin portlet(war) into tomcat 8 :

Error log :

Thread-MULTI_VM_PORTAL_CACHE_MANAGER-1" java.lang.OutOfMemoryError: GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.addConditionWaiter(AbstractQueuedSynchronizer.java:1855)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2068)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
06:16:30,443 ERROR [MemoryQuartzSchedulerEngineInstance_Worker-4][JobRunShell:222] Job com.liferay.blogs.web.messaging.CheckEntryMessageListener.com.liferay.blogs.web.messaging.CheckEntryMessageListener threw an unhandled Exception: 
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOf(Arrays.java:3332)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:622)
    at java.lang.StringBuffer.append(StringBuffer.java:383)
    at org.json.JSONTokener.nextString(JSONTokener.java:277)
    at org.json.JSONTokener.nextValue(JSONTokener.java:341)
    at org.json.JSONObject.<init>(JSONObject.java:205)
    at org.json.JSONTokener.nextValue(JSONTokener.java:344)
    at org.jabsorb.JSONSerializer.fromJSON(JSONSerializer.java:255)
    at com.liferay.portal.json.JSONFactoryImpl.deserialize(JSONFactoryImpl.java:181)
    at com.liferay.portal.kernel.json.JSONFactoryUtil.deserialize(JSONFactoryUtil.java:89)
    at com.liferay.portal.scheduler.quartz.internal.job.MessageSenderJob.doExecute(MessageSenderJob.java:77)
    at com.liferay.portal.scheduler.quartz.internal.job.MessageSenderJob.execute(MessageSenderJob.java:53)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
06:16:30,443 ERROR [MemoryQuartzSchedulerEngineInstance_Worker-1][SimpleThreadPool:569] Error while executing the Runnable: 
java.lang.OutOfMemoryError: GC overhead limit exceeded
06:16:30,446 ERROR [MemoryQuartzSchedulerEngineInstance_Worker-4][ErrorLogger:2361] Job (com.liferay.blogs.web.messaging.CheckEntryMessageListener.com.liferay.blogs.web.messaging.CheckEntryMessageListener threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.OutOfMemoryError: GC overhead limit exceeded]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:224)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOf(Arrays.java:3332)
    at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137)
    at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:622)
    at java.lang.StringBuffer.append(StringBuffer.java:383)
    at org.json.JSONTokener.nextString(JSONTokener.java:277)
    at org.json.JSONTokener.nextValue(JSONTokener.java:341)
    at org.json.JSONObject.<init>(JSONObject.java:205)
    at org.json.JSONTokener.nextValue(JSONTokener.java:344)
    at org.jabsorb.JSONSerializer.fromJSON(JSONSerializer.java:255)
    at com.liferay.portal.json.JSONFactoryImpl.deserialize(JSONFactoryImpl.java:181)
    at com.liferay.portal.kernel.json.JSONFactoryUtil.deserialize(JSONFactoryUtil.java:89)
    at com.liferay.portal.scheduler.quartz.internal.job.MessageSenderJob.doExecute(MessageSenderJob.java:77)
    at com.liferay.portal.scheduler.quartz.internal.job.MessageSenderJob.execute(MessageSenderJob.java:53)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
    ... 1 more
06:16:30,446 ERROR [QuartzScheduler_PersistedQuartzSchedulerEngineInstance-NON_CLUSTERED_MisfireHandler][PortalJobStore:3939] MisfireHandler: Error handling misfires: Failed to obtain DB connection from data source 'ds': java.lang.OutOfMemoryError: GC overhead limit exceeded
org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'ds': java.lang.OutOfMemoryError: GC overhead limit exceeded [See nested exception: java.lang.OutOfMemoryError: GC overhead limit exceeded]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:771)
    at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3156)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3934)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3955)
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
06:16:30,458 ERROR [fileinstall-C:/Naresh/liferay-developer-studio/worksapce/liferay-workspace/bundles/osgi/portal][org_apache_felix_fileinstall:97] In main loop, we have serious trouble 
java.lang.OutOfMemoryError: GC overhead limit exceeded
06:16:32,050 ERROR [fileinstall-C:/Naresh/liferay-developer-studio/worksapce/liferay-workspace/bundles/osgi/war][org_apache_felix_fileinstall:97] In main loop, we have serious trouble 
java.lang.OutOfMemoryError: GC overhead limit exceeded
    at aQute.bnd.osgi.Clazz.constantClass(Clazz.java:825)
    at aQute.bnd.osgi.Clazz.parseClassFile(Clazz.java:560)
    at aQute.bnd.osgi.Clazz.parseClassFile(Clazz.java:501)
    at aQute.bnd.osgi.Clazz.parseClassFileWithCollector(Clazz.java:489)
    at aQute.bnd.osgi.ClassDataCollectors.parse(ClassDataCollectors.java:37)
    at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:223)
    at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:685)
    at com.liferay.portal.osgi.web.wab.generator.internal.processor.WabProcessor.transformToOSGiBundle(WabProcessor.java:1246)
    at com.liferay.portal.osgi.web.wab.generator.internal.processor.WabProcessor.getProcessedFile(WabProcessor.java:130)
    at com.liferay.portal.osgi.web.wab.generator.internal.WabGenerator.generate(WabGenerator.java:80)
    at com.liferay.portal.osgi.web.wab.generator.internal.connection.WabURLConnection.getInputStream(WabURLConnection.java:77)
    at java.net.URL.openStream(URL.java:1038)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:948)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:870)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:485)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313)

Can anyone help out?


Thanks,
​​​​​​​NAresh.
thumbnail
Olaf Kock, modified 5 Years ago.

RE: java.lang.OutOfMemoryError: GC overhead limit exceeded

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Naresh Reddy KallamadiHi All,

I am keep on getting  java.lang.OutOfMemoryError: GC overhead limit exceeded when I treid to deploy plugin portlet(war) into tomcat 8 :
java.lang.OutOfMemoryError means that you haven't allocated enough memory to the process running. This can be either because you literally haven't allocated enough memory (e.g. if you're still running with a bundle's default memory settings, despite putting a lot of load onto the system), or because one of your plugins uses memory excessively (which might be on purpose or an accidental memory leak). Another option might be that you're running in a 32bit VM, which is severely limited in the memory it can provide to the process.

Start with the first option: How much memory did you allocate to the process? For Tomcat, that can often be found in tomcat/bin/setenv.sh (or setenv.bat), but you should also check the actual process, in case someone has configured it elsewhere, e.g. in a windows service configuration.
thumbnail
Naresh Reddy Kallamadi, modified 5 Years ago.

RE: java.lang.OutOfMemoryError: GC overhead limit exceeded

Regular Member Posts: 120 Join Date: 7/9/14 Recent Posts
Hi Olaf,

Thanks for reply.

below are my setnv.bat file:


set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true  -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -Xms1024m -XX:MaxPermSize=512m"









Thanks,
Naresh.
thumbnail
Olaf Kock, modified 5 Years ago.

RE: java.lang.OutOfMemoryError: GC overhead limit exceeded

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts
Naresh Reddy Kallamadi

below are my setnv.bat file:

set "CATALINA_OPTS=%CATALINA_OPTS% -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true  -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xmx1024m -Xms1024m -XX:MaxPermSize=512m"
Looks pretty much like the default settings.

The actual solution: Determine how much memory your application needs, and change both 1024 occurrences to that value. Optional: Validate if you need other settings (e.g. non-default GC configurations)

A quickfix that might help: Just double both 1024 occurrences and try again.

If, in the end, you determine, that any of your components has a memory leak, you'll need to fix it. Otherwise, if your server was just wrongly dimensioned, it'll continue to run smoothly (provided that it doesn't need more then 2048 MB of memory).
thumbnail
Christoph Rabel, modified 5 Years ago.

RE: java.lang.OutOfMemoryError: GC overhead limit exceeded

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Olaf KockLooks pretty much like the default settings.

Since the OP wrote that he uses tomcat 8, I guess, I conclude he uses Liferay 7.x. I found that 1024m is not quite enough for more than quick tests. It certainly isn't for productive use. I guess, Liferay agrees in general, new Liferay version already have higher defaults.

Doubling the memory is probably a good idea, I would also suggest to enable gc logging. e.g. like described in this article.
https://dzone.com/articles/enabling-and-analysing-the-garbage-collection-log

It should give you some hints and show you, how memory is used. There are several tools available to analyze the gc data and give you some nice graphs. It isn't sufficient to find memory leaks, but it can help you detect them.