You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Timo Meinen | mindmatters <Ti...@mindmatters.de> on 2009/06/23 10:26:08 UTC

Memory analysis after 'OutOfMemoryError PermGen space' error induced by redeployments

Hello,

we host a Tomcat 6 server with several webapps on it. It is used for  
continuous integration, so the test webapps are deployed often. We run  
into OutOfMemoryError: PermGen space after some redeployments and  
cannot find a solution.

I connected JConsole remotely and made a screenshot after some  
redeployments. The screenshot is attached to this mail. After the  
first redeployment of webapp 1 the PermGen raises to 150MB and after  
the deployment it is freed to 115 MB, which seems to be ok. However,  
the second redeployment won't release the PermGen as you can see on  
the screenshot. After that, every redeployment will take another 40MB  
of PermGen space wich leads to the OutOfMemory error, because we set  
the MaxPermSize to 256m.

I tried a manual GC, but this worked only once (see screenshot). After  
this, the GC was useless.


The start parameters of the tomcat server are:

-server -Xmx1g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled - 
Djava.awt.headless=true - 
javaagent:org.springframework.instrument-3.0.0.M2.jar


The stacktrace is:

SEVERE: org/springframework/web/context/request/ 
AbstractRequestAttributes
java.lang.OutOfMemoryError: PermGen space
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
	at java.lang.Class.getDeclaredMethod(Class.java:1935)
	at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java: 
1382)
	at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
	at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
1106)
	at  
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java: 
1509)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java: 
1474)
	at  
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 
1392)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
1150)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
	at java.util.ArrayList.writeObject(ArrayList.java:570)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java: 
945)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java: 
1461)
	at  
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 
1392)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
1150)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
	at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:315)
	at sun.rmi.transport.Transport$1.run(Transport.java:159)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
	at  
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
	at sun.rmi.transport.tcp.TCPTransport 
$ConnectionHandler.run0(TCPTransport.java:790)


And the screenshot:


Re: Memory analysis after 'OutOfMemoryError PermGen space' error induced by redeployments

Posted by Xie Xiaodong <xx...@gmail.com>.
Hello,

http://blogs.sun.com/fkieviet/entry/how_to_fix_the_dreaded
I recommend this article for your reference.



2009/6/23 Timo Meinen | mindmatters <Ti...@mindmatters.de>

> Obviously, my screenshot couldn't be attached to the mailinglist, so here
> is it:
>
> http://timomeinen.de/bilder/PermGenSpace.png
>
>
> Best regards
> Timo Meinen
>
> Am 23.06.2009 um 10:26 schrieb Timo Meinen | mindmatters:
>
>  Hello,
>>
>> we host a Tomcat 6 server with several webapps on it. It is used for
>> continuous integration, so the test webapps are deployed often. We run into
>> OutOfMemoryError: PermGen space after some redeployments and cannot find a
>> solution.
>>
>> I connected JConsole remotely and made a screenshot after some
>> redeployments. The screenshot is attached to this mail. After the first
>> redeployment of webapp 1 the PermGen raises to 150MB and after the
>> deployment it is freed to 115 MB, which seems to be ok. However, the second
>> redeployment won't release the PermGen as you can see on the screenshot.
>> After that, every redeployment will take another 40MB of PermGen space wich
>> leads to the OutOfMemory error, because we set the MaxPermSize to 256m.
>>
>> I tried a manual GC, but this worked only once (see screenshot). After
>> this, the GC was useless.
>>
>>
>> The start parameters of the tomcat server are:
>>
>> -server -Xmx1g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled
>> -Djava.awt.headless=true
>> -javaagent:org.springframework.instrument-3.0.0.M2.jar
>>
>>
>> The stacktrace is:
>>
>> SEVERE: org/springframework/web/context/request/AbstractRequestAttributes
>> java.lang.OutOfMemoryError: PermGen space
>>        at java.lang.Class.getDeclaredMethods0(Native Method)
>>        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>>        at java.lang.Class.getDeclaredMethod(Class.java:1935)
>>        at
>> java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1382)
>>        at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
>>        at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
>>        at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
>>        at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
>>        at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>        at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>        at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>        at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>        at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>        at java.util.ArrayList.writeObject(ArrayList.java:570)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>        at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>        at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>        at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>        at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>        at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
>>        at
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:315)
>>        at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>        at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>        at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>
>>
>> And the screenshot:
>>
>>
>>
>>
>>
>> Any help would be great for us. Thank you very much.
>>
>> Timo Meinen
>>
>> --
>>
>> ---------------------------------------------------------------------------
>>                                                mindmatters GmbH & Co. KG
>> Neuer Kamp 30
>> 20357 Hamburg - St. Pauli
>>
>> Fon:     +49 40 4840593 0
>> Fax:     +49 40 4840593 9
>> Website: www.mindmatters.de
>>
>> Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
>> Persönl. haftende Gesellschafterin: mindmatters Verwaltungsgesellschaft
>> mbH
>> Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
> Viele Grüße
> Timo Meinen
>
> --
> ---------------------------------------------------------------------------
>                                                 mindmatters GmbH & Co. KG
> Neuer Kamp 30
> 20357 Hamburg - St. Pauli
>
> Fon:     +49 40 4840593 0
> Fax:     +49 40 4840593 9
> Website: www.mindmatters.de
>
> Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
> Persönl. haftende Gesellschafterin: mindmatters Verwaltungsgesellschaft mbH
> Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Sincerely yours and Best Regards,
Xie Xiaodong

Re: Memory analysis after 'OutOfMemoryError PermGen space' error induced by redeployments

Posted by Mark Thomas <ma...@apache.org>.
Timo Meinen | mindmatters wrote:
> Obviously, my screenshot couldn't be attached to the mailinglist, so
> here is it:
> 
> http://timomeinen.de/bilder/PermGenSpace.png

http://markmail.org/message/fcbvwapt6afyndxn

HTH,

Mark

> 
> 
> Best regards
> Timo Meinen
> 
> Am 23.06.2009 um 10:26 schrieb Timo Meinen | mindmatters:
> 
>> Hello,
>>
>> we host a Tomcat 6 server with several webapps on it. It is used for
>> continuous integration, so the test webapps are deployed often. We run
>> into OutOfMemoryError: PermGen space after some redeployments and
>> cannot find a solution.
>>
>> I connected JConsole remotely and made a screenshot after some
>> redeployments. The screenshot is attached to this mail. After the
>> first redeployment of webapp 1 the PermGen raises to 150MB and after
>> the deployment it is freed to 115 MB, which seems to be ok. However,
>> the second redeployment won't release the PermGen as you can see on
>> the screenshot. After that, every redeployment will take another 40MB
>> of PermGen space wich leads to the OutOfMemory error, because we set
>> the MaxPermSize to 256m.
>>
>> I tried a manual GC, but this worked only once (see screenshot). After
>> this, the GC was useless.
>>
>>
>> The start parameters of the tomcat server are:
>>
>> -server -Xmx1g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled
>> -Djava.awt.headless=true
>> -javaagent:org.springframework.instrument-3.0.0.M2.jar
>>
>>
>> The stacktrace is:
>>
>> SEVERE: org/springframework/web/context/request/AbstractRequestAttributes
>> java.lang.OutOfMemoryError: PermGen space
>>     at java.lang.Class.getDeclaredMethods0(Native Method)
>>     at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>>     at java.lang.Class.getDeclaredMethod(Class.java:1935)
>>     at
>> java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1382)
>>     at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
>>     at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
>>     at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
>>     at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1106)
>>     at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>>
>>     at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>>     at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>
>>     at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>     at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>     at java.util.ArrayList.writeObject(ArrayList.java:570)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>     at
>> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>>     at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>>     at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>>
>>     at
>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>     at
>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>>     at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
>>     at
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:315)
>>     at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>     at java.security.AccessController.doPrivileged(Native Method)
>>     at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>     at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>     at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>
>>
>>
>> And the screenshot:
>>
>>
>>
>>
>>
>> Any help would be great for us. Thank you very much.
>>
>> Timo Meinen
>>
>> -- 
>> ---------------------------------------------------------------------------
>>
>>                                                 mindmatters GmbH & Co. KG
>> Neuer Kamp 30
>> 20357 Hamburg - St. Pauli
>>
>> Fon:     +49 40 4840593 0
>> Fax:     +49 40 4840593 9
>> Website: www.mindmatters.de
>>
>> Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
>> Persönl. haftende Gesellschafterin: mindmatters
>> Verwaltungsgesellschaft mbH
>> Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> Viele Grüße
> Timo Meinen
> 
> -- 
> ---------------------------------------------------------------------------
>                                                  mindmatters GmbH & Co. KG
> Neuer Kamp 30
> 20357 Hamburg - St. Pauli
> 
> Fon:     +49 40 4840593 0
> Fax:     +49 40 4840593 9
> Website: www.mindmatters.de
> 
> Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
> Persönl. haftende Gesellschafterin: mindmatters Verwaltungsgesellschaft mbH
> Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory analysis after 'OutOfMemoryError PermGen space' error induced by redeployments

Posted by Timo Meinen | mindmatters <Ti...@mindmatters.de>.
Obviously, my screenshot couldn't be attached to the mailinglist, so  
here is it:

http://timomeinen.de/bilder/PermGenSpace.png


Best regards
Timo Meinen

Am 23.06.2009 um 10:26 schrieb Timo Meinen | mindmatters:

> Hello,
>
> we host a Tomcat 6 server with several webapps on it. It is used for  
> continuous integration, so the test webapps are deployed often. We  
> run into OutOfMemoryError: PermGen space after some redeployments  
> and cannot find a solution.
>
> I connected JConsole remotely and made a screenshot after some  
> redeployments. The screenshot is attached to this mail. After the  
> first redeployment of webapp 1 the PermGen raises to 150MB and after  
> the deployment it is freed to 115 MB, which seems to be ok. However,  
> the second redeployment won't release the PermGen as you can see on  
> the screenshot. After that, every redeployment will take another  
> 40MB of PermGen space wich leads to the OutOfMemory error, because  
> we set the MaxPermSize to 256m.
>
> I tried a manual GC, but this worked only once (see screenshot).  
> After this, the GC was useless.
>
>
> The start parameters of the tomcat server are:
>
> -server -Xmx1g -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled - 
> Djava.awt.headless=true - 
> javaagent:org.springframework.instrument-3.0.0.M2.jar
>
>
> The stacktrace is:
>
> SEVERE: org/springframework/web/context/request/ 
> AbstractRequestAttributes
> java.lang.OutOfMemoryError: PermGen space
> 	at java.lang.Class.getDeclaredMethods0(Native Method)
> 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
> 	at java.lang.Class.getDeclaredMethod(Class.java:1935)
> 	at  
> java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java: 
> 1382)
> 	at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:52)
> 	at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:438)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:413)
> 	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:310)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
> 1106)
> 	at  
> java 
> .io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java: 
> 1509)
> 	at  
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java: 
> 1474)
> 	at  
> java 
> .io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 
> 1392)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
> 1150)
> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java: 
> 326)
> 	at java.util.ArrayList.writeObject(ArrayList.java:570)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at  
> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java: 
> 945)
> 	at  
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java: 
> 1461)
> 	at  
> java 
> .io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java: 
> 1392)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java: 
> 1150)
> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java: 
> 326)
> 	at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:274)
> 	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java: 
> 315)
> 	at sun.rmi.transport.Transport$1.run(Transport.java:159)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> 	at  
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java: 
> 535)
> 	at sun.rmi.transport.tcp.TCPTransport 
> $ConnectionHandler.run0(TCPTransport.java:790)
>
>
> And the screenshot:
>
>
>
>
>
> Any help would be great for us. Thank you very much.
>
> Timo Meinen
>
> --
> ---------------------------------------------------------------------------
>                                                 mindmatters GmbH &  
> Co. KG
> Neuer Kamp 30
> 20357 Hamburg - St. Pauli
>
> Fon:     +49 40 4840593 0
> Fax:     +49 40 4840593 9
> Website: www.mindmatters.de
>
> Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
> Persönl. haftende Gesellschafterin: mindmatters  
> Verwaltungsgesellschaft mbH
> Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

Viele Grüße
Timo Meinen

--
---------------------------------------------------------------------------
                                                  mindmatters GmbH &  
Co. KG
Neuer Kamp 30
20357 Hamburg - St. Pauli

Fon:     +49 40 4840593 0
Fax:     +49 40 4840593 9
Website: www.mindmatters.de

Handelsregister: Amtsgericht Hamburg | HRA 97304 | UID DE225251880
Persönl. haftende Gesellschafterin: mindmatters  
Verwaltungsgesellschaft mbH
Amtsgericht Hamburg | HRB 84595 | Geschäftsführer: Frank Schmitz


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org