tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: RE : Tomcat7 OutOFMemoryError
Date Tue, 06 Mar 2012 08:15:57 GMT
Pid wrote:
> On 06/03/2012 07:12, Rainer Frey wrote:
>> On 05.03.2012, at 14:14, Philippe ROUXEL wrote:
>>
>>>>> When I set JAVA_OPTS= -Xmx1024m -Xss75m
>>>> That means: each thread get a stack of 75MB. One of the following applies:
>>>> * the operating system has a limit on thread stack size
>>>> * the per process memory limit is reached before all initial tomcat threads
are started
>>>> * the system runs out of total memory before all initial tomcat threads are
started
>>>>
>>>> 75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps
you meant to set -Xms (which sets the initial Java heap size)?
>>> 75MB of stack is needed by hibenate to save the data aka a graph.
>> I haven't used hibernate personally, but I never heard anything like that. So please
elaborate. Where did you get that information?
>> Also what do you mean with "graph"? The graph of associated objects that are updated
by one hibernate call, or is your data actually graph data?
>> If so, how is that mapped? do you have any self-referential associations?
>> Is it really stack that you are talking about?
> 
> I'm also interested in the answers to these questions.
> 

Ok, to get back to the OP's original question/assumption :

Assuming that "-Xss75M" tells the JVM to allocate 75 MB of memory for the stack of each 
new thread created by the JVM, and noting that for a typical Tomcat instance, a minimum of

about 10 threads seem to be created (with an additional one for each request being 
processed), this setting of "-Xss75M" would mean that a minimum of 750 MB is being 
allocated for the threads' stack.

Assuming on the other hand that this is a 32-bit system and JVM (the OP didn't really say,

but was mentioning Windows XP), where the maximum addressable memory for a process is 4 GB

(of which 1 GB more or less are used by the OS itself); and considering the setting of 
-Xmx1024M for the Heap; and considering that the rest of the JVM and Tomcat may use some 
1024 MB by themselves (for other things than the Heap and thread stacks);
Considering all this thus, it is not really so surprising that the OP would get an OOM 
error at some point.

Noting on the other hand that the JVM stack should be mainly used to push and pop 
subroutine/function parameters as they are being called, and that a reasonable stack size

seems to be around 512KB at most, this explains several comments here which seem to put in

doubt the wisdom of allocation 75 MB for the stack of each Java thread.

I am far from a specialist, but considering that Hibernate seems to be some kind of 
"generic" tool, it is a bit unlikely that using it would require to set the stack size to

an amount that is at least 150 times the JVM default, no ?

All this seems to point - as usual - to some application problem, with as Chris pointed 
out some runaway recursive function call or similar.



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


Mime
View raw message