Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nilesh Gundecha
LR 6.1 OutOfMemoryError: PermGen space
January 23, 2012 11:32 PM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 189

Join Date: November 30, 2009

Recent Posts

I am using Liferay 6.1 CE GA Tomcat Bundle and When I deploy my portlet plugin in it, its repeatedly giving me below exception

 1Exception in thread "liferay/mail-1" java.lang.OutOfMemoryError: PermGen space
 2[12:51:42 PM] Akash: SEVERE: Error waiting for multi-thread deployment of directories to completehostConfig.deployWar=Deploying web application archive {0}
 3java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
 4        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
 5        at java.util.concurrent.FutureTask.get(FutureTask.java:83)
 6        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1018)
 7        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
 8        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1453)
 9        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
10        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
11        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
12        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1338)
13        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1496)
14        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1506)
15        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1485)
16        at java.lang.Thread.run(Thread.java:662)
17Caused by: java.lang.OutOfMemoryError: PermGen space
18        at java.lang.Throwable.getStackTraceElement(Native Method)
19        at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
20        at java.lang.Throwable.printStackTraceAsCause(Throwable.java:529)
21        at java.lang.Throwable.printStackTrace(Throwable.java:516)
22        at org.springframework.beans.factory.BeanCreationException.printStackTrace(BeanCreationException.java:176)
23        at org.apache.log4j.DefaultThrowableRenderer.render(DefaultThrowableRenderer.java:60)
24        at org.apache.log4j.spi.ThrowableInformation.getThrowableStrRep(ThrowableInformation.java:87)
25        at org.apache.log4j.spi.LoggingEvent.getThrowableStrRep(LoggingEvent.java:413)
26        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:313)
27        at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
28        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
29        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
30        at org.apache.log4j.Category.callAppenders(Category.java:206)
31        at org.apache.log4j.Category.forcedLog(Category.java:391)
32        at org.apache.log4j.Category.log(Category.java:856)
33        at org.apache.commons.logging.impl.Log4JLogger.error(Log4JLogger.java:25
34        at org.springframework.web.context.ContextLoader.initWebApplicationConte
35        at org.springframework.web.context.ContextLoaderListener.contextInitiali
36        at com.liferay.portal.spring.context.PortletContextLoaderListener.contex
37        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextList
38        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePor
39        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLif
40        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLif
41        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLife
42        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextList
43        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
44        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
45        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
46        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
47        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:84
48        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
49        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
50
5107:16:04,354 ERROR [ContextLoader:227] Context initialization failed



Here is my tomcat\bin\setenv.sh

1JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT [b]-Xmx1024m[/b] -XX:MaxPermSize=256m"


I dont know whats going wrong. Can anyone please gimme some inputs on this?

Regards,
Nilesh
Alexander Chow
RE: LR 6.1 OutOfMemoryError: PermGen space
January 24, 2012 6:16 AM
Answer

Alexander Chow

LIFERAY STAFF

Rank: Liferay Master

Posts: 519

Join Date: July 19, 2005

Recent Posts

I'm not sure what your system configuration is like, but your java.lang.OutOfMemoryError is related to the PermGen space -- which is the parameter "-XX:MaxPermSize=256m". Take a look at the performance tuning section of our user guide.

Alex
Nilesh Gundecha
RE: LR 6.1 OutOfMemoryError: PermGen space
January 24, 2012 6:40 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 189

Join Date: November 30, 2009

Recent Posts

Alexander Chow:
I'm not sure what your system configuration is like, but your java.lang.OutOfMemoryError is related to the PermGen space -- which is the parameter "-XX:MaxPermSize=256m". Take a look at the performance tuning section of our user guide.

Alex


Thanks Alexander. The link you sent was useful.
Nilesh Gundecha
RE: LR 6.1 OutOfMemoryError: PermGen space
February 1, 2012 11:33 PM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 189

Join Date: November 30, 2009

Recent Posts

Hi Alexander,

After monitoring Liferay 6.1 for some time, I have a feeling that Liferay 6.1 takes huge amount of memory in comparison to what it use to take in Liferay 6.0 (I guess almost double). I am getting OutOfMemoryError quite frequently - its not that I get only when I redeploy my portlet-plugin, but even while using it.

Overview of my Liferay setup: -

- Liferay 6.1.0 CE GA1 with Tomcat 7.0.23 bundle. MySQL 5.5.
- Additional custom 1 ext-plugin, 1 hook-plugin, 2 theme-plugin and 1 portlet-plugin (These I had in LR 6.0 also, now upgraded these to Liferay 6.1)

This setup is hosted on Rackspace Cloud server having 1 GB RAM.
And configured Tomcat JAVA_OPTS is -Xmx1024m -XX:MaxPermSize=256m
I did try few combinations for performance tuning, but still not able too figure out the solution. Or is it that 1 GB RAM is not sufficient for Liferay 6.1.

With this I am facing lot of memory issues and frequent OutOfMemoryError. Whats your view on this?

Regards,

Nilesh
Alexander Chow
RE: LR 6.1 OutOfMemoryError: PermGen space
February 2, 2012 2:34 AM
Answer

Alexander Chow

LIFERAY STAFF

Rank: Liferay Master

Posts: 519

Join Date: July 19, 2005

Recent Posts

Hi Nilesh,

If your server has 1GB of RAM that means Tomcat will not be able to allocate 1GB of RAM… there are other things running in the OS that are going to take up memory. Incidentally, most people will start off with a configuration of -Xms1024m -Xmx1024m -XX:MaxPermSize=256m … but I'm not sure you can even do that, because you will have less than 1GB of RAM to work with. I know you are running your system on a backspace cloud server, but have you experienced a lot of OutOfMemoryError's in your local machine while performance testing? I would suspect your local machine has more than 1GB?

About whether 6.1 uses more memory than 6.0, this is undoubtedly true. How much… I am not entirely sure. However, every new version (especially a major revision like 6.1) is going to have new features and inevitably require more memory. You can disable a lot of things (outlined in the user guide link I gave you above) but that may or may not be enough for you.

Alex
Nilesh Gundecha
RE: LR 6.1 OutOfMemoryError: PermGen space
February 2, 2012 3:11 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 189

Join Date: November 30, 2009

Recent Posts

Thanks for the reply Alex.

In my local development system which has 2 GB RAM installed, I got OutOfMemoryError few times but definitely not very frequent. But ofcourse it has slowed down my computer. My common observation is that My Tomcat process (along with my custom plugins deployed) use to consume around 400Mb - 500Mb with Liferay 6.0. And with Liferay 6.1 its always around 700 MB - 800 Mb range (sometimes crossed 950MB as well).

I am just wondering if this increase in memory usage is just because of the new feature addition, or there is also some memory leak issues.

Regards,
Nilesh
Alexander Chow
RE: LR 6.1 OutOfMemoryError: PermGen space
February 2, 2012 3:59 AM
Answer

Alexander Chow

LIFERAY STAFF

Rank: Liferay Master

Posts: 519

Join Date: July 19, 2005

Recent Posts

I hope we don't have any memory leak issues. We have a team that does a lot of testing in that area so they should've caught the a problem if it exists. Besides, if you are saying "its always around 700 MB - 800 Mb range" then it isn't growing (leaking) at any noticeable rate.

BTW, how are you measuring your memory consumption? If you are using your OS's system console or something like that, this is not an accurate way of measuring memory usage. It may be that your GC needs to be tuned. Use a profiler or try using VisualVM to see how your heap/permgen is being utilised.
Olaf Kock
RE: LR 6.1 OutOfMemoryError: PermGen space
February 5, 2012 3:34 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1838

Join Date: September 23, 2008

Recent Posts

Alexander Chow:
Incidentally, most people will start off with a configuration of -Xms1024m -Xmx1024m -XX:MaxPermSize=256m … but I'm not sure you can even do that, because you will have less than 1GB of RAM to work with.


I want to point to the importance of this setting in production environments: However much memory you assign to your tomcat, make it claim it immediately (-Xms and -Xmx having the same values) - this way you get to see memory problems on startup (when you're most likely around) and not Sunday nights at 3am when the JVM can't claim more memory from the OS.

Speaking of 2G of memory in your local environment: It depends on what else you run in there and if it hits the virtual memory on disk. Naturally, once memory is being swapped out to disk because it doesn't fit the RAM, you'll notice heavy performance degradations. In production I prefer to not have any swap space at all - I want to see the problems when they appear, and not have to guess the cause of sudden performance degradations.
Jonathan Quach
RE: LR 6.1 OutOfMemoryError: PermGen space
March 30, 2012 8:40 AM
Answer

Jonathan Quach

Rank: New Member

Posts: 1

Join Date: March 8, 2012

Recent Posts

Hey Alexander:

Wondering if you can help decipher this message (new to Liferay) and wondering if this is related to this thread:

09:42:25,476 ERROR [ContextLoader:227] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'com.liferay.portal.kernel.util.FastDateFormatFactoryUtil' defined in cla
ss path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.lifer
ay.portal.util.FastDateFormatFactoryImpl#1e26602' of type [com.liferay.portal.ut
il.FastDateFormatFactoryImpl] while setting bean property 'fastDateFormatFactory
'; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'com.liferay.portal.util.FastDateFormatFactoryImpl
#1e26602' defined in class path resource [META-INF/util-spring.xml]: Instantiati
on of bean failed; nested exception is java.lang.OutOfMemoryError: PermGen space

INFO: Server startup in 16565 ms

Thank you in advance for your assistance.

Jonathan
David H Nebinger
RE: LR 6.1 OutOfMemoryError: PermGen space
March 30, 2012 9:33 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6975

Join Date: September 1, 2006

Recent Posts

Along same lines. Increase the amount of memory Liferay can use and try again.
Hitoshi Ozawa
RE: LR 6.1 OutOfMemoryError: PermGen space
March 30, 2012 9:12 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Alexander, it seems there is a memory leak in CE and not in EE.

http://www.liferay.com/community/forums/-/message_boards/message/13149294
Alexander Chow
RE: LR 6.1 OutOfMemoryError: PermGen space
April 2, 2012 12:35 PM
Answer

Alexander Chow

LIFERAY STAFF

Rank: Liferay Master

Posts: 519

Join Date: July 19, 2005

Recent Posts

From what that post says, it sounds like when they are running 6.1 CE, the client side has a growth in memory usage and only on IE8. Why this is not happening on 6.1 EE (according to their data) I don't know.

Besides, this present mb thread is about a memory leak on the server (permgen), not the client (browser).
Wole Adetiba
RE: LR 6.1 OutOfMemoryError: PermGen space
June 1, 2012 6:58 AM
Answer

Wole Adetiba

Rank: New Member

Posts: 10

Join Date: November 9, 2007

Recent Posts

Hi Nilesh,

I am having similar problems to you. Were you able to work-around this? I am running Liferay + Tomcat bundle on Mac OS. Starting Liferay alone gulps about 800MB of RAM.

Regards,

Wole
Nilesh Gundecha
RE: LR 6.1 OutOfMemoryError: PermGen space
June 1, 2012 11:17 PM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 189

Join Date: November 30, 2009

Recent Posts

Hi Wole,

Ya, i no more have issues with OutofMemoryError. As per my observation, I found that for running Liferay 6.1, 1 GB of System RAM is not sufficient. It needs to be atleast 2 GB.

You need to make some change in JAVA_OPTS value as it is shown below

1JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF8 -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT [b]-Xms1024m -Xmx1024m -XX:MaxPermSize=512m[/b]"


If you change -XX:MaxPermSize from 256m to 512m, this problem should get resolved.

Regards,
Nilesh
Wole Adetiba
RE: LR 6.1 OutOfMemoryError: PermGen space
June 4, 2012 2:07 AM
Answer

Wole Adetiba

Rank: New Member

Posts: 10

Join Date: November 9, 2007

Recent Posts

Hi Nilesh,

The change "-XX:MaxPermSize from 256m to 512m" does the magic. Thanks.

Regards,

Wole
Olaf Kock
RE: LR 6.1 OutOfMemoryError: PermGen space
June 5, 2012 8:16 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1838

Join Date: September 23, 2008

Recent Posts

...and then change JAVA_OPTS to CATALINA_OPTS if you also use more heapspace and run out of system memory when you try to shut down tomcat...
samuel tian
RE: LR 6.1 OutOfMemoryError: PermGen space
June 14, 2012 2:10 AM
Answer

samuel tian

Rank: New Member

Posts: 5

Join Date: June 14, 2012

Recent Posts

With default -XX:MaxPermSize=256m, i got perm space error while deploying my portlet.

after increases perm space value to 512m problem gone, but instead i got

1
209:01:11,842 INFO  [PortalImpl:4873] Current URL /poller/receive generates exception: null
309:01:14,917 INFO  [PortalImpl:4873] Current URL /poller/receive generates exception: null


Every time i navigate from one page to another or refresh the current page. LR Community 6.1.
Olaf Kock
RE: LR 6.1 OutOfMemoryError: PermGen space
June 14, 2012 4:49 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1838

Join Date: September 23, 2008

Recent Posts

I've seen this as well but never followed through and looked at the source for it.

Poller is part of the chat portlet, so obviously you have the chatportlet installed/embedded on the page. AFAIK It's nothing to worry about, just nasty logfile pollution