tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: java.lang.OutOfMemoryError: PermGen space
Date Fri, 21 Oct 2016 18:45:16 GMT
-----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


Mime
View raw message