You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Moore, Jon, Vodafone UK" <Jo...@vodafone.com> on 2016/10/20 10:00:09 UTC

java.lang.OutOfMemoryError: PermGen space

I have a problem where our customers application server stops working intermittently and when we check the Tomcat logs we get the message " java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is still running, and we have to restart the Tomcat service. I am a complete novice when it comes to Tomcat but am expected to resolve this issue as this server is part of the Avaya telephony solution.

I have 2 questions please.

1 - What would be causing this.

2 - What are the default Java memory settings for Initial memory pool, maximum memory pool size and thread stack size when the fields are blank when you use the "Configure Tomcat" interface on Windows. I was wondering if changing one or more of these settings would help ?

We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and JVM version is 1.6.0_20-b02

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


RE: java.lang.OutOfMemoryError: PermGen space

Posted by "Berneburg, Cris J. - US" <cb...@caci.com>.
Hi Jon

-----Original Message-----
From: Moore, Jon, Vodafone UK [mailto:Jon.Moore@vodafone.com] 
Sent: Thursday, October 20, 2016 6:00 AM
To: users@tomcat.apache.org
Subject: java.lang.OutOfMemoryError: PermGen space

> I have a problem where our customers application server stops
> working intermittently and when we check the Tomcat logs we get the
> message " java.lang.OutOfMemoryError: PermGen space" but the Tomcat
> service is still running, and we have to restart the Tomcat service. I
> am a complete novice when it comes to Tomcat but am expected to
> resolve this issue as this server is part of the Avaya telephony
> solution.
>
> I have 2 questions please.
>
> 1 - What would be causing this.

In my very limited experience it is likely a "memory leak" in your application "hosted" inside of Tomcat rather than Tomcat itself.  You will need to debug your application.

I went through something very similar starting in July 2016, starting off as a complete newbie.  See threads relating to "OutOfMemoryError: PermGen space" for the whole sorry affair.  :-)

> 2 - What are the default Java memory settings for Initial memory pool,
> maximum memory pool size and thread stack size when the fields are
> blank when you use the "Configure Tomcat" interface on Windows. I was
> wondering if changing one or more of these settings would help ?

FWIW, I agree with the other folks saying not to alter these settings as the solution to solve your problem.  If you have a memory leak, increasing the size of the memory will not stop the leak.

I suggest following a path that was recommended to me.  Start by reading this:

http://markmail.org/message/fcbvwapt6afyndxn

> 1. Find an app that you can't reload without OOME.
> 2. Get a profiler [...]
> 3. Reload you app once.
> 4. Use the profiler to look for instances of WebappClassLoader.
> 5. Look for the one with the started attribute == false.
> 6. Trace the GC roots for this instance.

In the process, I learned how to perform a Java "heap dump" and how to use a memory analyzer.  FYI, I used Eclipse Memory Analyzer (free) to track things down.  This will be a learning experience for you too.  ;-)

> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and
> JVM version is 1.6.0_20-b02

Thanks for providing those details.  :-)  We had almost the same setup as you, but Win2012 instead of 2008.  FYI, upgrading from Java 6 to 8 did not fix my memory leak.

Good luck, and let us know your progress!

--
Cris Berneburg
CACI Lead Software Engineer


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


Re: java.lang.OutOfMemoryError: PermGen space

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jon,

On 10/21/16 3:46 AM, Moore, Jon, Vodafone UK wrote:
> Yes I am a novice at Java as well. I support the IVR system that 
> points to the application servers and have ended up trying to
> resolve this issue as our developers of the applications can't
> help.

Understood. Welcome to the Java world. :)

> The way we are told on the training to deploy the application in
> the IVR is to use the deploy/un-deploy options in tomcat manager. I
> have also seen a colleague make a copy of the applications war file
> away from its normal folder (webapps), stop the tomcat Windows
> service, delete the applications deployed folder and restart the
> tomcat windows service to re-deploy the application.

Since you are using manager-based deply/undeploy, you could very well
be running into a classloader-pinning error. If there's no hope of
modifying the code to fix any leaks, the only remedy is to bounce the
entire JVM after a certain number of redeploy operations. If you find
that you can redeploy 10 times before you get permgen OOMEs, then
you'll need to keep a count and restart after e.g. 8 redeployments.

If you *can* fix the code, the manager has a "find memory leaks"
button that can help you find out if an application has not undeployed
properly: deploy the application in a fresh Tomcat start-up. Then,
undeploy the application, wait 5-10 seconds, and click the "find
memory leaks" button. If it syas there are no leaks, then you may just
need a slightly larger permgen in general and you'll be fine.

If it says there are problems, start a new thread on this mailing list
asking for help identifying and fixing those leaks.

> I have tried to run the commands you suggested from a CMD box but 
> nothing gets outputted.

Hmm.

Try NOT piping-through the FINDSTR program and looking at the output
of the initial "java" command. I don't have a Windows system to play
with ATM so I'm doing a bit of guesswork, here. "FIND" is garbage
compared to a proper "grep". I had never even heard of FINDSTR before.

- -chris

> -----Original Message----- From: Christopher Schultz 
> [mailto:chris@christopherschultz.net] Sent: 20 October 2016 17:40
> To: Tomcat Users List Subject: Re: java.lang.OutOfMemoryError:
> PermGen space
> 
> Jon,
> 
> On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
>> I have a problem where our customers application server stops 
>> working intermittently and when we check the Tomcat logs we get
>> the message " java.lang.OutOfMemoryError: PermGen space" but the
>> Tomcat service is still running, and we have to restart the
>> Tomcat service. I am a complete novice when it comes to Tomcat
>> but am expected to resolve this issue as this server is part of
>> the Avaya telephony solution.
> 
>> I have 2 questions please.
> 
>> 1 - What would be causing this.
> 
> Are you also a Java novice as well? No judgement... I just want to 
> adjust my level of snark appropriately :)
> 
> Java has a special heap space called the "permanent generation" (a 
> term which becomes less descriptive as time goes on) but basically 
> all java.lang.Class objects loaded by the JVM go there. The more 
> libraries and other stuff that gets loaded, the more space in
> permgen is used. The defaults for the size of permgen are often
> fairly small, and you may have to raise them. This is especially
> true for applications that use large frameworks like Spring.
> 
> Raising the permgen space is almost always the right decision
> under normal circumstances when you get an OOME:permgen error. I
> would double whatever its current value is and monitor the
> application for a while to see if that improves things.
> 
> The only situation I know of where raising the permgen size is not 
> the right move is when there is a "classloader-pinning leak". That 
> happens when you hot-deploy an application many times, but the old 
> versions of the application are not undeploying cleanly. This 
> situation is quite the rabbit-hole, so I'll stop there unless you
> can confirm that you do hot-deployments without restarting Tomcat
> and the JVM.
> 
> If you instead get OOME for other reasons, it's frequently NOT the 
> right decision to increase the heap size because it usually
> indicates that there is a memory leak in the application and giving
> it more heap just means you'll wait longer between failures.
> Instead, the application should be fixed to not leak memory :)
> 
>> 2 - What are the default Java memory settings for Initial memory 
>> pool, maximum memory pool size and thread stack size when the 
>> fields are blank when you use the "Configure Tomcat" interface
>> on Windows. I was wondering if changing one or more of these
>> settings would help ?
> 
> The default depends upon the JVM and the OS.
> 
>> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard
>> and JVM version is 1.6.0_20-b02
> 
> Best way to find out for sure[1] is:
> 
> C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize
> 
> The two settings you are looking for are MaxHeapSize and 
> InitialHeapSize. Those values are in bytes, so you'll probably
> have to divide by 1024 a couple of times to get at the "real" value
> in human-readable terms.
> 
> The best way to find the default permgen size is:
> 
> C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize
> 
> Hope that helps, -chris
> 
> [1] 
> http://stackoverflow.com/questions/2915276/what-is-the-default-maximum
- -h
>
>
> 
eap-size-for-suns-jvm-from-java-se-6
> 
> ---------------------------------------------------------------------
>
>
> 
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
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYCmNYAAoJEBzwKT+lPKRYT90P/jPh8rDdBNEamXBXLzAEkSE2
UVObMtiM64RY6eJg5i+Rv0O5UWXH9HZuEofqMbyArbSfAWjraCymA0e0pfI4MzNu
FpOSBbBQyGXTfQzA2uyOwytMVmG5pARz21mWFF5VDQr2P+wFU+Dyp+vBdKJo+FZ2
Y0V5trVKon7ou6qpOUn8pAoT+P0qUxr2J5in2I2ilBBNORi4Pwuzbs2Xver0ktUL
eqtpDveRFyvq9ewXtE1k92o6WF0eEMqFZ/BJX7bP21087wqJwDf7MLmFnzdLhHMV
yJqrdKzI24Vj5cTSgVyWLVvM2MmL5iDfPurpY4yQFHw56ZSvo9fSZsrUM8UYbvOc
ujeJcaPXZU3+jNm5UvVw1PIZmUDvAsYC4y06kxc+L5A7pikTFuOAWc9MlxSw3mbR
E2/BRFgzk1OXE73LuVjIEaBhwFnJ/telA2r42dw38SkNvH7GZl6Yn9FoYsq7gVXQ
7RS3PNoQFeGzS8saaXv2GaemLoceRxQOodQYBh0e2Xb5RJ8s8HqiJPgSP8VxqfQU
fbwGJ91z7Er7SLsEJGE78M31uJsfcagyc6rUIJ7b5Z+F/Q6CV7vzUCU0gWnRugds
+Bzv3B1kVqrpLSPBbO6idObD7+Was9OKzrYMiYAWd6BIlYs8ElT0FIyLRWmQcf2S
YIOJpeQHwiONWEQkJj53
=2zin
-----END PGP SIGNATURE-----

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


Re: java.lang.OutOfMemoryError: PermGen space

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Andr�,

On 10/21/16 11:15 AM, Andr� Warnier (tomcat) wrote:
> Hi. Understood. Make sure that you are looking at the "Java" tab.

And at the right Service name. The tomcat6w.exe can be used to
configure any number of services. If you've got the wrong one, you'll
be configuring something OTHER than what you want to configure.

Do you have multiple Tomcat6-based services configured? If so, make
sure you are editing the right now.

> I have an old installation of Tomcat 6 on my laptop, and took a 
> screenshot of that tab. I am not sure that the image that I attach
> will make it on the list however (it strips most attachments). If
> not, here are the parameters which I see in the Java tab, in the
> box "Java Options" :
> 
> -Djava.io.tmpdir=C:\apache-tomcat-6.0.24\temp 
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
> -Djava.util.logging.config.file=C:\apache-tomcat-6.0.24\conf\logging.p
roperties
>
> 
> 
> There is nothing about memory there, but this is where you should
> add the relevant switches for the Java PermGen, one per line.
> 
> Further down, there are 3 more boxes :
> 
> Initial memory pool : 128 MB Maximum memory pool : 256 MB Thread
> stack size : (blank)
> 
> The first 2 are the Java Heap size (which is not your problem). On
> my laptop, the JVM for the above is Sun's jdk7_u45. Your mileage
> may vary..
> 
> There may be more to find out searching Google for "java default
> memory settings" or similar.
> 
> This link provides an example of a setting for Java 6 / Tomcat 7 : 
> http://stackoverflow.com/questions/21104340/increase-windows-installer
- -based-tomcat-permgen-space
>
> 
> 
> I saw something somewhere which mentioned 64 MB as the default
> PermGen (no guarantees).
> 
> Another proviso : at this point, I am not quite sure if the PermGen
> is or not a part of the Heap (Chuck ?).

PermGen is not a part of any other heap space: it is separate.

> If it is, and you increase the PermGen, you may need to also
> increase the Heap size accordingly (see the 2 boxes above).

Not necessary.

> For maximum performance, it is also recommended to set the
> "initial" and "maximum" Heap size values above to the same value
> (use the maximum of course), as this avoids the JVM spending some
> time resizing the heap dynamically.
> 
> In any case, and still without guarantees or liability of any
> kind, if you have enough memory on that server, it would probably
> not hurt to set the following :
> 
> Initial memory pool : 1024 MB Maximum memory pool : 1024 MB

Eh. I wouldn't increase anything you don't need to increase. I've seen
JVMs configured for huge heaps on multi-tenant VMs that have
over-committed the physical hardware. The hypervisor does what it can,
and every VM runs slow as a dog. If you don't need a gig of RAM, don't
requested it.

> and add the options -XX:PermSize=128m -XX:MaxPermSize=128m
> 
> to the Java Options.

+1

- -chris

> On 21.10.2016 16:25, Moore, Jon, Vodafone UK wrote:
>> Thanks Andre.
>> 
>> When I open up tomcat6w.exe the fields are all blank, hence
>> trying to find out what the defaults are before I enter anything
>> in them as I don't want to put in a lesser value then the
>> defaults.
>> 
>> -----Original Message----- From: Andr� Warnier (tomcat)
>> [mailto:aw@ice-sa.com] Sent: 21 October 2016 09:34 To:
>> users@tomcat.apache.org Subject: Re: java.lang.OutOfMemoryError:
>> PermGen space
>> 
>> On 21.10.2016 09:46, Moore, Jon, Vodafone UK wrote:
>>> Thanks Chris. (and to everyone else who has replied)
>>> 
>>> Yes I am a novice at Java as well. I support the IVR system
>>> that points to the application servers and have ended up trying
>>> to resolve this issue as our developers of the applications
>>> can't help.
>>> 
>>> The way we are told on the training to deploy the application
>>> in the IVR is to use the deploy/un-deploy options in tomcat
>>> manager. I have also seen a colleague make a copy of the
>>> applications war file away from its normal folder (webapps),
>>> stop the tomcat Windows service, delete the applications
>>> deployed folder and restart the tomcat windows service to
>>> re-deploy the application.
>>> 
>>> I have tried to run the commands you suggested from a CMD box
>>> but nothing gets outputted.
>>> 
>> 
>> Some additional info :
>> 
>> When Tomcat is running as a Service under Windows, the Java 
>> command-line switches (which allow to control the Java memory
>> sizes among other tings), are stored in the Windows Registry.
>> The Windows Tomcat-as-a-Service installation includes a program
>> (named "tomcat(version)w.exe", which is a kind of GUI Registry
>> Editor, specially for these Java/Tomcat related parameters.
>> Normally, this program is running, and appears as a small Apache
>> icon at the bottom right of the console. That is the program that
>> you should use, to change the Java startup parameters, and
>> stop/start Tomcat.
>> 
>> As explained in previous posts here on this list, and in some of
>> the articles to which I pointed you in Google, it may be that
>> your issue is only that the default PermGen size, is insufficient
>> for your application(s), and that just increasing the Java
>> PermGen size would solve the problem definitely.
>> 
>> Or not, if the application is flawed. But you can at least try.
>> 
>> For the full story about tomcat(x)w.exe, try the Tomcat FAQ
>> (which does not seem to be on-line right now, or very slow), and
>> look for an article entitled "what are tomcatx.exe and
>> tomcatxw.exe". Ah, here :
>> http://wiki.apache.org/tomcat/FAQ/Windows
>> 
>> 
>>> 
>>> -----Original Message----- From: Christopher Schultz
>>> [mailto:chris@christopherschultz.net] Sent: 20 October 2016
>>> 17:40 To: Tomcat Users List Subject: Re:
>>> java.lang.OutOfMemoryError: PermGen space
>>> 
> Jon,
> 
> On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
>>>>> I have a problem where our customers application server
>>>>> stops working intermittently and when we check the Tomcat
>>>>> logs we get the message " java.lang.OutOfMemoryError:
>>>>> PermGen space" but the Tomcat service is still running, and
>>>>> we have to restart the Tomcat service. I am a complete
>>>>> novice when it comes to Tomcat but am expected to resolve 
>>>>> this issue as this server is part of the Avaya telephony
>>>>> solution.
>>>>> 
>>>>> I have 2 questions please.
>>>>> 
>>>>> 1 - What would be causing this.
> 
> Are you also a Java novice as well? No judgement... I just want to 
> adjust my level of snark appropriately :)
> 
> Java has a special heap space called the "permanent generation" (a 
> term which becomes less descriptive as time goes on) but basically 
> all java.lang.Class objects loaded by the JVM go there. The more 
> libraries and other stuff that gets loaded, the more space in
> permgen is used. The defaults for the size of permgen are often
> fairly small, and you may have to raise them. This is especially
> true for applications that use large frameworks like Spring.
> 
> Raising the permgen space is almost always the right decision
> under normal circumstances when you get an OOME:permgen error. I
> would double whatever its current value is and monitor the
> application for a while to see if that improves things.
> 
> The only situation I know of where raising the permgen size is not 
> the right move is when there is a "classloader-pinning leak". That 
> happens when you hot-deploy an application many times, but the old 
> versions of the application are not undeploying cleanly. This 
> situation is quite the rabbit-hole, so I'll stop there unless you
> can confirm that you do hot-deployments without restarting Tomcat
> and the JVM.
> 
> If you instead get OOME for other reasons, it's frequently NOT the 
> right decision to increase the heap size because it usually
> indicates that there is a memory leak in the application and giving
> it more heap just means you'll wait longer between failures.
> Instead, the application should be fixed to not leak memory :)
> 
>>>>> 2 - What are the default Java memory settings for Initial
>>>>> memory pool, maximum memory pool size and thread stack size
>>>>> when the fields are blank when you use the "Configure
>>>>> Tomcat" interface on Windows. I was wondering if changing
>>>>> one or more of these settings would help ?
> 
> The default depends upon the JVM and the OS.
> 
>>>>> We are running Tomcat 6.0.26 on Windows Server 2008 R2
>>>>> standard and JVM version is 1.6.0_20-b02
> 
> Best way to find out for sure[1] is:
> 
> C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize
> 
> The two settings you are looking for are MaxHeapSize and 
> InitialHeapSize. Those values are in bytes, so you'll probably
> have to divide by 1024 a couple of times to get at the "real" value
> in human-readable terms.
> 
> The best way to find the default permgen size is:
> 
> C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize
> 
> Hope that helps, -chris
> 
> [1] 
> http://stackoverflow.com/questions/2915276/what-is-the-default-maximum
>
> 
- -h
> eap-size-for-suns-jvm-from-java-se-6
>>> 
>>> --------------------------------------------------------------------
- -
>>>
>>> 
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
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>>
>> 
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
>> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYCmI8AAoJEBzwKT+lPKRYdeQP/iupPv/s1e61oxKtDxddfEE2
usk+rKBlRnG9n3Nc9Es8KJUnJACPbHTsBvwi738d4nr8xtAaIriLNxl+p9nBDv39
DiuTf0jXcxzhWsHljUknZbKXv7VMniLOAr+NsSAuzHvFPgJPwf9f2t3Uwpt1PT4H
YKL71uWQUztDDKQXR9+1cLxdjMO0iKkvEBwQEDjQ+V/yu+xul6H3YKJiS6o6j5jO
fPIgoeFcS+juJmHBvRwAHOPNOX8jOtjh52lTshl1EqM7lJhdkvqTbPd+DjTFXdV4
uuLg8s1evCrsb6r+6tT8hZwq9H9TWpecEe/bP1s1gGSle6ttzaadUEzjj0W1693c
F14QV9fBq0e+Ak+9JIBTYO+vzeB5wreM+Wx57kclmTpWk4tQBS+zBC1kcI37Y4Ro
0i1eLj5uH32Wha7vy99Km3+t+fLR2pSGT4um8bCvLuZYu6WSvVreST9Dhe6RIyjH
4qy7Av6VudHFn6bEZi6SZBC9XkR0Fb8O+OAyUHq3XhMWleJTgw8NzYn7JXoA2sS9
fve6W56hXsEALU2Fu7DBKHIY6t6nEojRmLxmZ9913uoVt9CiID2vY6kKvxLUY5Cb
Q3zETRf//8JbCU9kSrtzfAs854+/aRDJgt6r2Q/KFq2pPkpPaDjDhsJg7ZUyfs/b
FPgZZlbi8sZhRvHAA545
=WQ/q
-----END PGP SIGNATURE-----

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


Re: java.lang.OutOfMemoryError: PermGen space

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
Hi.
Understood.
Make sure that you are looking at the "Java" tab.

I have an old installation of Tomcat 6 on my laptop, and took a screenshot of that tab.
I am not sure that the image that I attach will make it on the list however (it strips 
most attachments).
If not, here are the parameters which I see in the Java tab, in the box "Java Options" :

-Djava.io.tmpdir=C:\apache-tomcat-6.0.24\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\apache-tomcat-6.0.24\conf\logging.properties

There is nothing about memory there, but this is where you should add the relevant 
switches for the Java PermGen, one per line.

Further down, there are 3 more boxes :

Initial memory pool : 128 MB
Maximum memory pool : 256 MB
Thread stack size : (blank)

The first 2 are the Java Heap size (which is not your problem).
On my laptop, the JVM for the above is Sun's jdk7_u45.
Your mileage may vary..

There may be more to find out searching Google for "java default memory settings" or similar.

This link provides an example of a setting for Java 6 / Tomcat 7 :
http://stackoverflow.com/questions/21104340/increase-windows-installer-based-tomcat-permgen-space

I saw something somewhere which mentioned 64 MB as the default PermGen (no guarantees).

Another proviso : at this point, I am not quite sure if the PermGen is or not a part of 
the Heap (Chuck ?).
If it is, and you increase the PermGen, you may need to also increase the Heap size 
accordingly (see the 2 boxes above).

For maximum performance, it is also recommended to set the "initial" and "maximum" Heap 
size values above to the same value (use the maximum of course), as this avoids the JVM 
spending some time resizing the heap dynamically.

In any case, and still without guarantees or liability of any kind,
if you have enough memory on that server, it would probably not hurt to set the following :

Initial memory pool : 1024 MB
Maximum memory pool : 1024 MB

and add the options
-XX:PermSize=128m
-XX:MaxPermSize=128m

to the Java Options.



On 21.10.2016 16:25, Moore, Jon, Vodafone UK wrote:
> Thanks Andre.
>
> When I open up tomcat6w.exe the fields are all blank, hence trying to find out what the defaults are before I enter anything in them as I don't want to put in a lesser value then the defaults.
>
> -----Original Message-----
> From: Andr� Warnier (tomcat) [mailto:aw@ice-sa.com]
> Sent: 21 October 2016 09:34
> To: users@tomcat.apache.org
> Subject: Re: java.lang.OutOfMemoryError: PermGen space
>
> On 21.10.2016 09:46, Moore, Jon, Vodafone UK wrote:
>> Thanks Chris. (and to everyone else who has replied)
>>
>> Yes I am a novice at Java as well. I support the IVR system that points to the application servers and have ended up trying to resolve this issue as our developers of the applications can't help.
>>
>> The way we are told on the training to deploy the application in the IVR is to use the deploy/un-deploy options in tomcat manager. I have also seen a colleague make a copy of the applications war file away from its normal folder (webapps), stop the tomcat Windows service, delete the applications deployed folder and restart the tomcat windows service to re-deploy the application.
>>
>> I have tried to run the commands you suggested from a CMD box but nothing gets outputted.
>>
>
> Some additional info :
>
> When Tomcat is running as a Service under Windows, the Java command-line switches (which allow to control the Java memory sizes among other tings), are stored in the Windows Registry.  The Windows Tomcat-as-a-Service installation includes a program (named "tomcat(version)w.exe", which is a kind of GUI Registry Editor, specially for these Java/Tomcat related parameters.  Normally, this program is running, and appears as a small Apache icon at the bottom right of the console.
> That is the program that you should use, to change the Java startup parameters, and stop/start Tomcat.
>
> As explained in previous posts here on this list, and in some of the articles to which I pointed you in Google, it may be that your issue is only that the default PermGen size, is insufficient for your application(s), and that just increasing the Java PermGen size would solve the problem definitely.
>
> Or not, if the application is flawed. But you can at least try.
>
> For the full story about tomcat(x)w.exe, try the Tomcat FAQ (which does not seem to be on-line right now, or very slow), and look for an article entitled "what are tomcatx.exe and tomcatxw.exe".
> Ah, here : http://wiki.apache.org/tomcat/FAQ/Windows
>
>
>>
>> -----Original Message-----
>> From: Christopher Schultz [mailto:chris@christopherschultz.net]
>> Sent: 20 October 2016 17:40
>> To: Tomcat Users List
>> Subject: Re: java.lang.OutOfMemoryError: PermGen space
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> Jon,
>>
>> On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
>>> I have a problem where our customers application server stops working
>>> intermittently and when we check the Tomcat logs we get the message "
>>> java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is
>>> still running, and we have to restart the Tomcat service. I am a
>>> complete novice when it comes to Tomcat but am expected to resolve
>>> this issue as this server is part of the Avaya telephony solution.
>>>
>>> I have 2 questions please.
>>>
>>> 1 - What would be causing this.
>>
>> Are you also a Java novice as well? No judgement... I just want to
>> adjust my level of snark appropriately :)
>>
>> Java has a special heap space called the "permanent generation" (a term which becomes less descriptive as time goes on) but basically all java.lang.Class objects loaded by the JVM go there. The more libraries and other stuff that gets loaded, the more space in permgen is used.
>> The defaults for the size of permgen are often fairly small, and you may have to raise them. This is especially true for applications that use large frameworks like Spring.
>>
>> Raising the permgen space is almost always the right decision under normal circumstances when you get an OOME:permgen error. I would double whatever its current value is and monitor the application for a while to see if that improves things.
>>
>> The only situation I know of where raising the permgen size is not the right move is when there is a "classloader-pinning leak". That happens when you hot-deploy an application many times, but the old versions of the application are not undeploying cleanly. This situation is quite the rabbit-hole, so I'll stop there unless you can confirm that you do hot-deployments without restarting Tomcat and the JVM.
>>
>> If you instead get OOME for other reasons, it's frequently NOT the
>> right decision to increase the heap size because it usually indicates
>> that there is a memory leak in the application and giving it more heap
>> just means you'll wait longer between failures. Instead, the
>> application should be fixed to not leak memory :)
>>
>>> 2 - What are the default Java memory settings for Initial memory
>>> pool, maximum memory pool size and thread stack size when the fields
>>> are blank when you use the "Configure Tomcat" interface on Windows. I
>>> was wondering if changing one or more of these settings would help ?
>>
>> The default depends upon the JVM and the OS.
>>
>>> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and
>>> JVM version is 1.6.0_20-b02
>>
>> Best way to find out for sure[1] is:
>>
>> C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize
>>
>> The two settings you are looking for are MaxHeapSize and InitialHeapSize. Those values are in bytes, so you'll probably have to divide by 1024 a couple of times to get at the "real" value in human-readable terms.
>>
>> The best way to find the default permgen size is:
>>
>> C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize
>>
>> Hope that helps,
>> - -chris
>>
>> [1]
>> http://stackoverflow.com/questions/2915276/what-is-the-default-maximum
>> -h
>> eap-size-for-suns-jvm-from-java-se-6
>> -----BEGIN PGP SIGNATURE-----
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIcBAEBCAAGBQJYCPN3AAoJEBzwKT+lPKRYCXEQAK3AKioa7kRPTvs24yj+1vq6
>> SFo20WtjFhBrqyhSRdcvcwUjoDAIS6d6wqjDQ13v919jFRTsqCrDh9FQg1MeCWVB
>> UJVmcV33XjTQUmqEY03YUPwOVjgQe6RJM+FJAE60werkHEEirg85gL/WamQ+QtfW
>> C39sp2NO6kHpD7VWnBKPhToNmcy7lz2EK6Ye8aEXkn2mk2PZhJFRysgTqeJ/CChA
>> KnUzWAqrDBM3OtHerivHuIEHhJB7+43bD9kiX7JZXDlcVkubAz6bep3m2sXO3T9O
>> VYZs0ACKvnzuc6kqkStMcsGUeLWvYc5+xhCDNcxGhYXjrIWOaW5aS9QipZmAXze7
>> IoY2UC4vxyajRNuFmLeUWaeICDtYZaf/5d3wrlsbCIWF/vf2C+NpuynEidq6N6Yv
>> pFvTqRd+ZsNEbsKaQwaHSHsfQVxtQbPlFfUlYWvu7vz+Y5xCyTSFoct2UqDcBedi
>> Bo+vdHVoih/i9+4Zhg+Bieh5lygcoE9VS0KX2yu+4kwaaSohFoxwHcHXoD1SjXTU
>> FDq2H+GXV/3bS/hAek+5WzQuPJC5etsqcMUfIcf8YjrDmR6BabEvQFk5p9APYV+x
>> 7lcODhWFlF3tEOvKiIRmPuQz/d4/hR5ETo6h12g2UMsfY9ogEZF7I8SP1uNK3bpO
>> cH97Lssd2MS5qj/Kd/m5
>> =JBc2
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: java.lang.OutOfMemoryError: PermGen space

Posted by "Moore, Jon, Vodafone UK" <Jo...@vodafone.com>.
Thanks Andre.

When I open up tomcat6w.exe the fields are all blank, hence trying to find out what the defaults are before I enter anything in them as I don't want to put in a lesser value then the defaults.

-----Original Message-----
From: André Warnier (tomcat) [mailto:aw@ice-sa.com] 
Sent: 21 October 2016 09:34
To: users@tomcat.apache.org
Subject: Re: java.lang.OutOfMemoryError: PermGen space

On 21.10.2016 09:46, Moore, Jon, Vodafone UK wrote:
> Thanks Chris. (and to everyone else who has replied)
>
> Yes I am a novice at Java as well. I support the IVR system that points to the application servers and have ended up trying to resolve this issue as our developers of the applications can't help.
>
> The way we are told on the training to deploy the application in the IVR is to use the deploy/un-deploy options in tomcat manager. I have also seen a colleague make a copy of the applications war file away from its normal folder (webapps), stop the tomcat Windows service, delete the applications deployed folder and restart the tomcat windows service to re-deploy the application.
>
> I have tried to run the commands you suggested from a CMD box but nothing gets outputted.
>

Some additional info :

When Tomcat is running as a Service under Windows, the Java command-line switches (which allow to control the Java memory sizes among other tings), are stored in the Windows Registry.  The Windows Tomcat-as-a-Service installation includes a program (named "tomcat(version)w.exe", which is a kind of GUI Registry Editor, specially for these Java/Tomcat related parameters.  Normally, this program is running, and appears as a small Apache icon at the bottom right of the console.
That is the program that you should use, to change the Java startup parameters, and stop/start Tomcat.

As explained in previous posts here on this list, and in some of the articles to which I pointed you in Google, it may be that your issue is only that the default PermGen size, is insufficient for your application(s), and that just increasing the Java PermGen size would solve the problem definitely.

Or not, if the application is flawed. But you can at least try.

For the full story about tomcat(x)w.exe, try the Tomcat FAQ (which does not seem to be on-line right now, or very slow), and look for an article entitled "what are tomcatx.exe and tomcatxw.exe".
Ah, here : http://wiki.apache.org/tomcat/FAQ/Windows


>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: 20 October 2016 17:40
> To: Tomcat Users List
> Subject: Re: java.lang.OutOfMemoryError: PermGen space
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Jon,
>
> On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
>> I have a problem where our customers application server stops working 
>> intermittently and when we check the Tomcat logs we get the message "
>> java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is 
>> still running, and we have to restart the Tomcat service. I am a 
>> complete novice when it comes to Tomcat but am expected to resolve 
>> this issue as this server is part of the Avaya telephony solution.
>>
>> I have 2 questions please.
>>
>> 1 - What would be causing this.
>
> Are you also a Java novice as well? No judgement... I just want to 
> adjust my level of snark appropriately :)
>
> Java has a special heap space called the "permanent generation" (a term which becomes less descriptive as time goes on) but basically all java.lang.Class objects loaded by the JVM go there. The more libraries and other stuff that gets loaded, the more space in permgen is used.
> The defaults for the size of permgen are often fairly small, and you may have to raise them. This is especially true for applications that use large frameworks like Spring.
>
> Raising the permgen space is almost always the right decision under normal circumstances when you get an OOME:permgen error. I would double whatever its current value is and monitor the application for a while to see if that improves things.
>
> The only situation I know of where raising the permgen size is not the right move is when there is a "classloader-pinning leak". That happens when you hot-deploy an application many times, but the old versions of the application are not undeploying cleanly. This situation is quite the rabbit-hole, so I'll stop there unless you can confirm that you do hot-deployments without restarting Tomcat and the JVM.
>
> If you instead get OOME for other reasons, it's frequently NOT the 
> right decision to increase the heap size because it usually indicates 
> that there is a memory leak in the application and giving it more heap 
> just means you'll wait longer between failures. Instead, the 
> application should be fixed to not leak memory :)
>
>> 2 - What are the default Java memory settings for Initial memory 
>> pool, maximum memory pool size and thread stack size when the fields 
>> are blank when you use the "Configure Tomcat" interface on Windows. I 
>> was wondering if changing one or more of these settings would help ?
>
> The default depends upon the JVM and the OS.
>
>> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and 
>> JVM version is 1.6.0_20-b02
>
> Best way to find out for sure[1] is:
>
> C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize
>
> The two settings you are looking for are MaxHeapSize and InitialHeapSize. Those values are in bytes, so you'll probably have to divide by 1024 a couple of times to get at the "real" value in human-readable terms.
>
> The best way to find the default permgen size is:
>
> C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize
>
> Hope that helps,
> - -chris
>
> [1]
> http://stackoverflow.com/questions/2915276/what-is-the-default-maximum
> -h
> eap-size-for-suns-jvm-from-java-se-6
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYCPN3AAoJEBzwKT+lPKRYCXEQAK3AKioa7kRPTvs24yj+1vq6
> SFo20WtjFhBrqyhSRdcvcwUjoDAIS6d6wqjDQ13v919jFRTsqCrDh9FQg1MeCWVB
> UJVmcV33XjTQUmqEY03YUPwOVjgQe6RJM+FJAE60werkHEEirg85gL/WamQ+QtfW
> C39sp2NO6kHpD7VWnBKPhToNmcy7lz2EK6Ye8aEXkn2mk2PZhJFRysgTqeJ/CChA
> KnUzWAqrDBM3OtHerivHuIEHhJB7+43bD9kiX7JZXDlcVkubAz6bep3m2sXO3T9O
> VYZs0ACKvnzuc6kqkStMcsGUeLWvYc5+xhCDNcxGhYXjrIWOaW5aS9QipZmAXze7
> IoY2UC4vxyajRNuFmLeUWaeICDtYZaf/5d3wrlsbCIWF/vf2C+NpuynEidq6N6Yv
> pFvTqRd+ZsNEbsKaQwaHSHsfQVxtQbPlFfUlYWvu7vz+Y5xCyTSFoct2UqDcBedi
> Bo+vdHVoih/i9+4Zhg+Bieh5lygcoE9VS0KX2yu+4kwaaSohFoxwHcHXoD1SjXTU
> FDq2H+GXV/3bS/hAek+5WzQuPJC5etsqcMUfIcf8YjrDmR6BabEvQFk5p9APYV+x
> 7lcODhWFlF3tEOvKiIRmPuQz/d4/hR5ETo6h12g2UMsfY9ogEZF7I8SP1uNK3bpO
> cH97Lssd2MS5qj/Kd/m5
> =JBc2
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>


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


Re: java.lang.OutOfMemoryError: PermGen space

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 21.10.2016 09:46, Moore, Jon, Vodafone UK wrote:
> Thanks Chris. (and to everyone else who has replied)
>
> Yes I am a novice at Java as well. I support the IVR system that points to the application servers and have ended up trying to resolve this issue as our developers of the applications can't help.
>
> The way we are told on the training to deploy the application in the IVR is to use the deploy/un-deploy options in tomcat manager. I have also seen a colleague make a copy of the applications war file away from its normal folder (webapps), stop the tomcat Windows service, delete the applications deployed folder and restart the tomcat windows service to re-deploy the application.
>
> I have tried to run the commands you suggested from a CMD box but nothing gets outputted.
>

Some additional info :

When Tomcat is running as a Service under Windows, the Java command-line switches (which 
allow to control the Java memory sizes among other tings), are stored in the Windows 
Registry.  The Windows Tomcat-as-a-Service installation includes a program (named 
"tomcat(version)w.exe", which is a kind of GUI Registry Editor, specially for these 
Java/Tomcat related parameters.  Normally, this program is running, and appears as a small 
Apache icon at the bottom right of the console.
That is the program that you should use, to change the Java startup parameters, and 
stop/start Tomcat.

As explained in previous posts here on this list, and in some of the articles to which I 
pointed you in Google, it may be that your issue is only that the default PermGen size, is 
insufficient for your application(s), and that just increasing the Java PermGen size would 
solve the problem definitely.

Or not, if the application is flawed. But you can at least try.

For the full story about tomcat(x)w.exe, try the Tomcat FAQ (which does not seem to be 
on-line right now, or very slow), and look for an article entitled "what are tomcatx.exe 
and tomcatxw.exe".
Ah, here : http://wiki.apache.org/tomcat/FAQ/Windows


>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: 20 October 2016 17:40
> To: Tomcat Users List
> Subject: Re: java.lang.OutOfMemoryError: PermGen space
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Jon,
>
> On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
>> I have a problem where our customers application server stops working
>> intermittently and when we check the Tomcat logs we get the message "
>> java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is
>> still running, and we have to restart the Tomcat service. I am a
>> complete novice when it comes to Tomcat but am expected to resolve
>> this issue as this server is part of the Avaya telephony solution.
>>
>> I have 2 questions please.
>>
>> 1 - What would be causing this.
>
> Are you also a Java novice as well? No judgement... I just want to adjust my level of snark appropriately :)
>
> Java has a special heap space called the "permanent generation" (a term which becomes less descriptive as time goes on) but basically all java.lang.Class objects loaded by the JVM go there. The more libraries and other stuff that gets loaded, the more space in permgen is used.
> The defaults for the size of permgen are often fairly small, and you may have to raise them. This is especially true for applications that use large frameworks like Spring.
>
> Raising the permgen space is almost always the right decision under normal circumstances when you get an OOME:permgen error. I would double whatever its current value is and monitor the application for a while to see if that improves things.
>
> The only situation I know of where raising the permgen size is not the right move is when there is a "classloader-pinning leak". That happens when you hot-deploy an application many times, but the old versions of the application are not undeploying cleanly. This situation is quite the rabbit-hole, so I'll stop there unless you can confirm that you do hot-deployments without restarting Tomcat and the JVM.
>
> If you instead get OOME for other reasons, it's frequently NOT the right decision to increase the heap size because it usually indicates that there is a memory leak in the application and giving it more heap just means you'll wait longer between failures. Instead, the application should be fixed to not leak memory :)
>
>> 2 - What are the default Java memory settings for Initial memory pool,
>> maximum memory pool size and thread stack size when the fields are
>> blank when you use the "Configure Tomcat" interface on Windows. I was
>> wondering if changing one or more of these settings would help ?
>
> The default depends upon the JVM and the OS.
>
>> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and
>> JVM version is 1.6.0_20-b02
>
> Best way to find out for sure[1] is:
>
> C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize
>
> The two settings you are looking for are MaxHeapSize and InitialHeapSize. Those values are in bytes, so you'll probably have to divide by 1024 a couple of times to get at the "real" value in human-readable terms.
>
> The best way to find the default permgen size is:
>
> C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize
>
> Hope that helps,
> - -chris
>
> [1]
> http://stackoverflow.com/questions/2915276/what-is-the-default-maximum-h
> eap-size-for-suns-jvm-from-java-se-6
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBCAAGBQJYCPN3AAoJEBzwKT+lPKRYCXEQAK3AKioa7kRPTvs24yj+1vq6
> SFo20WtjFhBrqyhSRdcvcwUjoDAIS6d6wqjDQ13v919jFRTsqCrDh9FQg1MeCWVB
> UJVmcV33XjTQUmqEY03YUPwOVjgQe6RJM+FJAE60werkHEEirg85gL/WamQ+QtfW
> C39sp2NO6kHpD7VWnBKPhToNmcy7lz2EK6Ye8aEXkn2mk2PZhJFRysgTqeJ/CChA
> KnUzWAqrDBM3OtHerivHuIEHhJB7+43bD9kiX7JZXDlcVkubAz6bep3m2sXO3T9O
> VYZs0ACKvnzuc6kqkStMcsGUeLWvYc5+xhCDNcxGhYXjrIWOaW5aS9QipZmAXze7
> IoY2UC4vxyajRNuFmLeUWaeICDtYZaf/5d3wrlsbCIWF/vf2C+NpuynEidq6N6Yv
> pFvTqRd+ZsNEbsKaQwaHSHsfQVxtQbPlFfUlYWvu7vz+Y5xCyTSFoct2UqDcBedi
> Bo+vdHVoih/i9+4Zhg+Bieh5lygcoE9VS0KX2yu+4kwaaSohFoxwHcHXoD1SjXTU
> FDq2H+GXV/3bS/hAek+5WzQuPJC5etsqcMUfIcf8YjrDmR6BabEvQFk5p9APYV+x
> 7lcODhWFlF3tEOvKiIRmPuQz/d4/hR5ETo6h12g2UMsfY9ogEZF7I8SP1uNK3bpO
> cH97Lssd2MS5qj/Kd/m5
> =JBc2
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>


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


RE: java.lang.OutOfMemoryError: PermGen space

Posted by "Moore, Jon, Vodafone UK" <Jo...@vodafone.com>.
Thanks Chris. (and to everyone else who has replied)

Yes I am a novice at Java as well. I support the IVR system that points to the application servers and have ended up trying to resolve this issue as our developers of the applications can't help.

The way we are told on the training to deploy the application in the IVR is to use the deploy/un-deploy options in tomcat manager. I have also seen a colleague make a copy of the applications war file away from its normal folder (webapps), stop the tomcat Windows service, delete the applications deployed folder and restart the tomcat windows service to re-deploy the application.

I have tried to run the commands you suggested from a CMD box but nothing gets outputted.

Regards

Jon Moore 

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 20 October 2016 17:40
To: Tomcat Users List
Subject: Re: java.lang.OutOfMemoryError: PermGen space

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jon,

On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
> I have a problem where our customers application server stops working 
> intermittently and when we check the Tomcat logs we get the message " 
> java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is 
> still running, and we have to restart the Tomcat service. I am a 
> complete novice when it comes to Tomcat but am expected to resolve 
> this issue as this server is part of the Avaya telephony solution.
> 
> I have 2 questions please.
> 
> 1 - What would be causing this.

Are you also a Java novice as well? No judgement... I just want to adjust my level of snark appropriately :)

Java has a special heap space called the "permanent generation" (a term which becomes less descriptive as time goes on) but basically all java.lang.Class objects loaded by the JVM go there. The more libraries and other stuff that gets loaded, the more space in permgen is used.
The defaults for the size of permgen are often fairly small, and you may have to raise them. This is especially true for applications that use large frameworks like Spring.

Raising the permgen space is almost always the right decision under normal circumstances when you get an OOME:permgen error. I would double whatever its current value is and monitor the application for a while to see if that improves things.

The only situation I know of where raising the permgen size is not the right move is when there is a "classloader-pinning leak". That happens when you hot-deploy an application many times, but the old versions of the application are not undeploying cleanly. This situation is quite the rabbit-hole, so I'll stop there unless you can confirm that you do hot-deployments without restarting Tomcat and the JVM.

If you instead get OOME for other reasons, it's frequently NOT the right decision to increase the heap size because it usually indicates that there is a memory leak in the application and giving it more heap just means you'll wait longer between failures. Instead, the application should be fixed to not leak memory :)

> 2 - What are the default Java memory settings for Initial memory pool, 
> maximum memory pool size and thread stack size when the fields are 
> blank when you use the "Configure Tomcat" interface on Windows. I was 
> wondering if changing one or more of these settings would help ?

The default depends upon the JVM and the OS.

> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and 
> JVM version is 1.6.0_20-b02

Best way to find out for sure[1] is:

C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize

The two settings you are looking for are MaxHeapSize and InitialHeapSize. Those values are in bytes, so you'll probably have to divide by 1024 a couple of times to get at the "real" value in human-readable terms.

The best way to find the default permgen size is:

C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize

Hope that helps,
- -chris

[1]
http://stackoverflow.com/questions/2915276/what-is-the-default-maximum-h
eap-size-for-suns-jvm-from-java-se-6
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYCPN3AAoJEBzwKT+lPKRYCXEQAK3AKioa7kRPTvs24yj+1vq6
SFo20WtjFhBrqyhSRdcvcwUjoDAIS6d6wqjDQ13v919jFRTsqCrDh9FQg1MeCWVB
UJVmcV33XjTQUmqEY03YUPwOVjgQe6RJM+FJAE60werkHEEirg85gL/WamQ+QtfW
C39sp2NO6kHpD7VWnBKPhToNmcy7lz2EK6Ye8aEXkn2mk2PZhJFRysgTqeJ/CChA
KnUzWAqrDBM3OtHerivHuIEHhJB7+43bD9kiX7JZXDlcVkubAz6bep3m2sXO3T9O
VYZs0ACKvnzuc6kqkStMcsGUeLWvYc5+xhCDNcxGhYXjrIWOaW5aS9QipZmAXze7
IoY2UC4vxyajRNuFmLeUWaeICDtYZaf/5d3wrlsbCIWF/vf2C+NpuynEidq6N6Yv
pFvTqRd+ZsNEbsKaQwaHSHsfQVxtQbPlFfUlYWvu7vz+Y5xCyTSFoct2UqDcBedi
Bo+vdHVoih/i9+4Zhg+Bieh5lygcoE9VS0KX2yu+4kwaaSohFoxwHcHXoD1SjXTU
FDq2H+GXV/3bS/hAek+5WzQuPJC5etsqcMUfIcf8YjrDmR6BabEvQFk5p9APYV+x
7lcODhWFlF3tEOvKiIRmPuQz/d4/hR5ETo6h12g2UMsfY9ogEZF7I8SP1uNK3bpO
cH97Lssd2MS5qj/Kd/m5
=JBc2
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: java.lang.OutOfMemoryError: PermGen space

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jon,

On 10/20/16 6:00 AM, Moore, Jon, Vodafone UK wrote:
> I have a problem where our customers application server stops
> working intermittently and when we check the Tomcat logs we get the
> message " java.lang.OutOfMemoryError: PermGen space" but the Tomcat
> service is still running, and we have to restart the Tomcat
> service. I am a complete novice when it comes to Tomcat but am
> expected to resolve this issue as this server is part of the Avaya
> telephony solution.
> 
> I have 2 questions please.
> 
> 1 - What would be causing this.

Are you also a Java novice as well? No judgement... I just want to
adjust my level of snark appropriately :)

Java has a special heap space called the "permanent generation" (a
term which becomes less descriptive as time goes on) but basically all
java.lang.Class objects loaded by the JVM go there. The more libraries
and other stuff that gets loaded, the more space in permgen is used.
The defaults for the size of permgen are often fairly small, and you
may have to raise them. This is especially true for applications that
use large frameworks like Spring.

Raising the permgen space is almost always the right decision under
normal circumstances when you get an OOME:permgen error. I would
double whatever its current value is and monitor the application for a
while to see if that improves things.

The only situation I know of where raising the permgen size is not the
right move is when there is a "classloader-pinning leak". That happens
when you hot-deploy an application many times, but the old versions of
the application are not undeploying cleanly. This situation is quite
the rabbit-hole, so I'll stop there unless you can confirm that you do
hot-deployments without restarting Tomcat and the JVM.

If you instead get OOME for other reasons, it's frequently NOT the
right decision to increase the heap size because it usually indicates
that there is a memory leak in the application and giving it more heap
just means you'll wait longer between failures. Instead, the
application should be fixed to not leak memory :)

> 2 - What are the default Java memory settings for Initial memory 
> pool, maximum memory pool size and thread stack size when the
> fields are blank when you use the "Configure Tomcat" interface on
> Windows. I was wondering if changing one or more of these settings
> would help ?

The default depends upon the JVM and the OS.

> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard
> and JVM version is 1.6.0_20-b02

Best way to find out for sure[1] is:

C:\> java -XX:+PrintFlagsFinal -version 2>&1 | findstr HeapSize

The two settings you are looking for are MaxHeapSize and
InitialHeapSize. Those values are in bytes, so you'll probably have to
divide by 1024 a couple of times to get at the "real" value in
human-readable terms.

The best way to find the default permgen size is:

C:\> java -XX:+PrintFlagsFinal -version 2>&1  | findstr PermSize

Hope that helps,
- -chris

[1]
http://stackoverflow.com/questions/2915276/what-is-the-default-maximum-h
eap-size-for-suns-jvm-from-java-se-6
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYCPN3AAoJEBzwKT+lPKRYCXEQAK3AKioa7kRPTvs24yj+1vq6
SFo20WtjFhBrqyhSRdcvcwUjoDAIS6d6wqjDQ13v919jFRTsqCrDh9FQg1MeCWVB
UJVmcV33XjTQUmqEY03YUPwOVjgQe6RJM+FJAE60werkHEEirg85gL/WamQ+QtfW
C39sp2NO6kHpD7VWnBKPhToNmcy7lz2EK6Ye8aEXkn2mk2PZhJFRysgTqeJ/CChA
KnUzWAqrDBM3OtHerivHuIEHhJB7+43bD9kiX7JZXDlcVkubAz6bep3m2sXO3T9O
VYZs0ACKvnzuc6kqkStMcsGUeLWvYc5+xhCDNcxGhYXjrIWOaW5aS9QipZmAXze7
IoY2UC4vxyajRNuFmLeUWaeICDtYZaf/5d3wrlsbCIWF/vf2C+NpuynEidq6N6Yv
pFvTqRd+ZsNEbsKaQwaHSHsfQVxtQbPlFfUlYWvu7vz+Y5xCyTSFoct2UqDcBedi
Bo+vdHVoih/i9+4Zhg+Bieh5lygcoE9VS0KX2yu+4kwaaSohFoxwHcHXoD1SjXTU
FDq2H+GXV/3bS/hAek+5WzQuPJC5etsqcMUfIcf8YjrDmR6BabEvQFk5p9APYV+x
7lcODhWFlF3tEOvKiIRmPuQz/d4/hR5ETo6h12g2UMsfY9ogEZF7I8SP1uNK3bpO
cH97Lssd2MS5qj/Kd/m5
=JBc2
-----END PGP SIGNATURE-----

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


Re: java.lang.OutOfMemoryError: PermGen space

Posted by Román Valoria <ro...@gmail.com>.
1. Bad memory settings or a java class having a memory leak.

2. The place to setup the values will depend if you run Tomcat as a Windows
Service, from the tomcat7.exe or from the startup.bat.

BTW, those are super outdated releases of OS, Java and Tomcat.

On Thu, Oct 20, 2016 at 6:00 PM, Moore, Jon, Vodafone UK <
Jon.Moore@vodafone.com> wrote:

> I have a problem where our customers application server stops working
> intermittently and when we check the Tomcat logs we get the message "
> java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is still
> running, and we have to restart the Tomcat service. I am a complete novice
> when it comes to Tomcat but am expected to resolve this issue as this
> server is part of the Avaya telephony solution.
>
> I have 2 questions please.
>
> 1 - What would be causing this.
>
> 2 - What are the default Java memory settings for Initial memory pool,
> maximum memory pool size and thread stack size when the fields are blank
> when you use the "Configure Tomcat" interface on Windows. I was wondering
> if changing one or more of these settings would help ?
>
> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and JVM
> version is 1.6.0_20-b02
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: java.lang.OutOfMemoryError: PermGen space

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 20.10.2016 12:00, Moore, Jon, Vodafone UK wrote:
> I have a problem where our customers application server stops working intermittently and when we check the Tomcat logs we get the message " java.lang.OutOfMemoryError: PermGen space" but the Tomcat service is still running, and we have to restart the Tomcat service. I am a complete novice when it comes to Tomcat but am expected to resolve this issue as this server is part of the Avaya telephony solution.
>
> I have 2 questions please.
>
> 1 - What would be causing this.
>
> 2 - What are the default Java memory settings for Initial memory pool, maximum memory pool size and thread stack size when the fields are blank when you use the "Configure Tomcat" interface on Windows. I was wondering if changing one or more of these settings would help ?
>
> We are running Tomcat 6.0.26 on Windows Server 2008 R2 standard and JVM version is 1.6.0_20-b02
>

Not a real answer to your question, but one important aspect as a start : these "default 
settings" are the settings of the JVM, not of Tomcat. There are no parameters in Tomcat 
itself which control those; Tomcat just "lives" in the JVM that runs it.

At a second level : these default settings (and the non-default ones), vary according to 
the JVM which you are using, its version, the host it is running on etc.
So you need to look up the values and parameters in the configuration documentation of the 
JVM vendor (e.g. Oracle, IBM, ..), not on the Tomcat site.

As for your question # 1 :
this would be a good start : http://lmgtfy.com/?q=java+permgen+space

Another answer would be : your application
(Note: I'm not kidding; it really depends on your applications.  Tomcat itself runs 
happily with the default JVM settings)





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