You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Karim Zaki <Ka...@itworx.com> on 2008/11/30 14:16:21 UTC

When does Tomcat throw an OutOfMemory exception?

Greetings all,

I would like someone to shed a bit of light on when exactly Tomcat throws an OutOfMemory exception. Is it when its physical memory usage (working set) reaches the maximum limit configured in the JVM startup parameters, or are other conditions that can cause this? I've noticed that sometimes I get these exceptions when the working set is well below the value specified in -Xmx.

Thanks,
Karim

-------------------------------------------------------------------------------
"Although the moon is smaller than the earth, it is farther away."


Re: When does Tomcat throw an OutOfMemory exception?

Posted by Kees Jan Koster <kj...@gmail.com>.
Dear Chuck,

>> Actually, in such situations you get 'java.io.IOException: Too many
>> open files' or 'java.net.SocketException: Too many open files'. Not  
>> an
>> OutOfMemory error.
>
> Only if it's related to an application-initiated action, such as  
> opening a stream.  If FD exhaustion is detected during an internal  
> JVM operation, that will often result in an OOME.

Oh, that is interesting. Thank you for correcting me. I guess they  
needed a RuntimeException and picked OOME. Grepping through the  
sources reveals that there are some other sources of OOME's too. I'd  
have to look at them to see which resource is actually being depleted,  
but it's a reminder to read the exception message with some attention.
--
Kees Jan

http://java-monitor.com/forum/
kjkoster@kjkoster.org
06-51838192

Human beings make life so interesting. Do you know that in a universe  
so full of wonders,
they have managed to invent boredom. Quite astonishing... -- Terry  
Partchett


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


RE: When does Tomcat throw an OutOfMemory exception?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Kees Jan Koster [mailto:kjkoster@gmail.com]
> Subject: Re: When does Tomcat throw an OutOfMemory exception?
>
> Actually, in such situations you get 'java.io.IOException: Too many
> open files' or 'java.net.SocketException: Too many open files'. Not an
> OutOfMemory error.

Only if it's related to an application-initiated action, such as opening a stream.  If FD exhaustion is detected during an internal JVM operation, that will often result in an OOME.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: When does Tomcat throw an OutOfMemory exception?

Posted by Kees Jan Koster <kj...@gmail.com>.
Dear Chuck,

> To add to Leon's list: running out of file descriptors.

Actually, in such situations you get 'java.io.IOException: Too many  
open files' or 'java.net.SocketException: Too many open files'. Not an  
OutOfMemory error.

</nitpick>
--
Kees Jan

http://java-monitor.com/forum/
kjkoster@kjkoster.org
06-51838192

Rule 1 for being in a hole: stop digging.


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


RE: When does Tomcat throw an OutOfMemory exception?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Karim Zaki [mailto:Karim.Zaki@itworx.com]
> Subject: RE: When does Tomcat throw an OutOfMemory exception?
>
> The JVM doesn't indicate which of these conditions
> actually caused the exception, though, does it?

Depends on the JVM version and vendor.  Newer ones from Sun are much better at describing the underlying problem.

To add to Leon's list: running out of file descriptors.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: When does Tomcat throw an OutOfMemory exception?

Posted by Karim Zaki <Ka...@itworx.com>.
Thanks for the clarification. The JVM doesn't indicate which of these conditions actually caused the exception, though, does it?

-----Original Message-----
From: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com]
Sent: Sunday, November 30, 2008 3:55 PM
To: Tomcat Users List
Subject: Re: When does Tomcat throw an OutOfMemory exception?

hi,

there are many occasions.

1. if there is no memory left (-Xmx)
2. if there is no perm gen space left (for example to many jsps)
3. if there is not enough space in the current heap and no time to
enlarge the heap (xms < xmx)
4. if a new thread couldn't be created
5-10 whatever the jvm vendor thought funny

regards
Leon

On Sun, Nov 30, 2008 at 2:16 PM, Karim Zaki <Ka...@itworx.com> wrote:
> Greetings all,
>
> I would like someone to shed a bit of light on when exactly Tomcat throws an OutOfMemory exception. Is it when its physical memory usage (working set) reaches the maximum limit configured in the JVM startup parameters, or are other conditions that can cause this? I've noticed that sometimes I get these exceptions when the working set is well below the value specified in -Xmx.
>
> Thanks,
> Karim
>
> -------------------------------------------------------------------------------
> "Although the moon is smaller than the earth, it is farther away."
>
>

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


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


Re: When does Tomcat throw an OutOfMemory exception?

Posted by Leon Rosenberg <ro...@googlemail.com>.
hi,

there are many occasions.

1. if there is no memory left (-Xmx)
2. if there is no perm gen space left (for example to many jsps)
3. if there is not enough space in the current heap and no time to
enlarge the heap (xms < xmx)
4. if a new thread couldn't be created
5-10 whatever the jvm vendor thought funny

regards
Leon

On Sun, Nov 30, 2008 at 2:16 PM, Karim Zaki <Ka...@itworx.com> wrote:
> Greetings all,
>
> I would like someone to shed a bit of light on when exactly Tomcat throws an OutOfMemory exception. Is it when its physical memory usage (working set) reaches the maximum limit configured in the JVM startup parameters, or are other conditions that can cause this? I've noticed that sometimes I get these exceptions when the working set is well below the value specified in -Xmx.
>
> Thanks,
> Karim
>
> -------------------------------------------------------------------------------
> "Although the moon is smaller than the earth, it is farther away."
>
>

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