You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by joel badia escolà <ba...@gmail.com> on 2012/10/02 01:07:51 UTC

Problems Increassing -Xmx

Hi all,

I'm trying to set up my max heap size in 2Gb but my tomcat
installation ignores me :( . I'm working with GNU/Linux Debian
"Squeeze" (Current Stable), and my tomcat version it's 6. I tried to
modify my /etc/init.d/tomcat6 file adding this (I add some context for
non Debian users):

# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
	JAVA_OPTS="-Djava.awt.headless=true -Xmx2000m" <---- RELEVANT
fi

And i tried to modify /usr/share/tomcat6/bin/catalina.sh like this:

if [ -z "$JPDA_OPTS" ]; then
    JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
fi
CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS -Xmx2000m"

In two cases i can't obtain favorable results, and it seems that
tomcat ignores me (YES I RESTART THE SERVER) and i get
"java.lang.OutOfMemoryError: Java heap space" error.

Can you help me,

Thanks,

Joel Badia Escolà

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


Re: Problems Increassing -Xmx

Posted by joel badia escolà <ba...@gmail.com>.
2012/10/2, Konstantin Kolinko <kn...@gmail.com>:
> 2012/10/2 Caldarale, Charles R <Ch...@unisys.com>:
>>> From: joel badia escolà [mailto:bastoigm@gmail.com]
>>> Subject: Problems Increassing -Xmx
>>
>>> if [ -z "$JAVA_OPTS" ]; then
>>>       JAVA_OPTS="-Djava.awt.headless=true -Xmx2000m" <---- RELEVANT
>>> fi
>>
>> And what happens if you don't put quotation marks around the values?
>>
>
> Quotes are OK. It is shell scripting, not Windows one.

Correct !

>
> What is not OK:
> 1. The statement inside of "if" executes only if $JAVA_OPTS is empty.
> Is it empty?
> 2. Learn the difference between JAVA_OPTS and CATALINA_OPTS variables.
>  You should not put such a value into JAVA_OPTS. You should not put it
> info both variables at the same time.
>
>>> And i tried to modify /usr/share/tomcat6/bin/catalina.sh like this:
>>
>> Don't do that; create a setenv.sh script to hold any environment variables
>> you need to set.

This solves the problem, i defined export JAVA_OPTS="$JAVA_OPTS
-Xmx2000m" in setenv.sh and i restarted the server. This has fixed the
problem ;)

Thanks a lot,

Joel Badia Escolà

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


Re: Problems Increassing -Xmx

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/10/2 Caldarale, Charles R <Ch...@unisys.com>:
>> From: joel badia escolà [mailto:bastoigm@gmail.com]
>> Subject: Problems Increassing -Xmx
>
>> if [ -z "$JAVA_OPTS" ]; then
>>       JAVA_OPTS="-Djava.awt.headless=true -Xmx2000m" <---- RELEVANT
>> fi
>
> And what happens if you don't put quotation marks around the values?
>

Quotes are OK. It is shell scripting, not Windows one.

What is not OK:
1. The statement inside of "if" executes only if $JAVA_OPTS is empty.
Is it empty?
2. Learn the difference between JAVA_OPTS and CATALINA_OPTS variables.
 You should not put such a value into JAVA_OPTS. You should not put it
info both variables at the same time.

>> And i tried to modify /usr/share/tomcat6/bin/catalina.sh like this:
>
> Don't do that; create a setenv.sh script to hold any environment variables you need to set.
>

+1

>> it seems that tomcat ignores me
>
> These are not Tomcat parameters, they are JVM system properties.
>

+1 s/properties/options/,  and only for Sun/Oracle/OpenJDK JVM

An OutOfMemory is a strange way to test this option.  It is easy to
exhaust a 2Gb heap if you are inaccurate.

Have you tried to search the archives of this mailing list?

Best regards,
Konstantin Kolinko

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


RE: Problems Increassing -Xmx

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: joel badia escolà [mailto:bastoigm@gmail.com] 
> Subject: Problems Increassing -Xmx

> if [ -z "$JAVA_OPTS" ]; then
>	JAVA_OPTS="-Djava.awt.headless=true -Xmx2000m" <---- RELEVANT
> fi

And what happens if you don't put quotation marks around the values?

> And i tried to modify /usr/share/tomcat6/bin/catalina.sh like this:

Don't do that; create a setenv.sh script to hold any environment variables you need to set.

> it seems that tomcat ignores me

These are not Tomcat parameters, they are JVM system properties.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Problems Increassing -Xmx

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

Ben,

On 10/1/12 10:27 PM, Ben Stringer wrote:
> Is it a 64-bit Debian install? If only 32-bit, you will be bumping
> up against the addressing limitations.

Not likely: when you hit JVM heap size restrictions, the JVM won't even
start. OOME is the wrong symptom, here.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBrHaAACgkQ9CaO5/Lv0PAl4wCgwvtxTeCUCih0Z/Gc5//g3LT+
TAUAnAwgCDGZjVF5Hxpzi+lujnzK8cV7
=Lapa
-----END PGP SIGNATURE-----

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


Re: Problems Increassing -Xmx

Posted by Ben Stringer <be...@burbong.com>.
Hi Joel,

Is it a 64-bit Debian install? If only 32-bit, you will be bumping up against the addressing limitations.

Cheers, Ben

On 02/10/2012, at 9:07 AM, joel badia escolà <ba...@gmail.com> wrote:

> Hi all,
> 
> I'm trying to set up my max heap size in 2Gb but my tomcat
> installation ignores me :( . I'm working with GNU/Linux Debian
> "Squeeze" (Current Stable), and my tomcat version it's 6. I tried to
> modify my /etc/init.d/tomcat6 file adding this (I add some context for
> non Debian users):
> 
> # Default Java options
> # Set java.awt.headless=true if JAVA_OPTS is not set so the
> # Xalan XSL transformer can work without X11 display on JDK 1.4+
> # It also looks like the default heap size of 64M is not enough for most cases
> # so the maximum heap size is set to 128M
> if [ -z "$JAVA_OPTS" ]; then
>    JAVA_OPTS="-Djava.awt.headless=true -Xmx2000m" <---- RELEVANT
> fi
> 
> And i tried to modify /usr/share/tomcat6/bin/catalina.sh like this:
> 
> if [ -z "$JPDA_OPTS" ]; then
>    JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
> fi
> CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS -Xmx2000m"
> 
> In two cases i can't obtain favorable results, and it seems that
> tomcat ignores me (YES I RESTART THE SERVER) and i get
> "java.lang.OutOfMemoryError: Java heap space" error.
> 
> Can you help me,
> 
> Thanks,
> 
> Joel Badia Escolà
> 
> ---------------------------------------------------------------------
> 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