Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Urgent! Tomcat4 closed giving Out of Memory Error

Tim Funk

2003-12-06

Replies:

I would hunt the archives, I did a search for outofmemoryerror native and saw
this - I am sure there are more similar threads with this issue:

http://marc.theaimsgroup.com/?l=tomcat-user&m=105535455830487&w=2

If _POSIX_THREAD_THREADS_MAX=64 - then you would have problems since that
means tomcat can only have 64 threads at one time. Tomcat is a single process
living under the JVM. (But then again - this is Linux and the process vs
thread model is sometimes a little strange)

(I don't use tomcat on linux too much so my trouble shooting skills there are
iffy)


-Tim

qi zhang wrote:

> I am using Linux2.4.20-smp. I think the limits for the entire system are
> not problem:
>
>>cat /proc/sys/kernel/threads-max
>
> 14336
>
>>cat /proc/sys/fs/file-max
>
> 209708
>
>>cat /proc/sys/fs/file-nr
>
> 2231   1366   209708
>
>>ulimit -a
>
> core file size     (blocks, -c) 0
> data seg size      (kbytes, -d) unlimited
> file size         (blocks, -f) unlimited
> max locked memory   (kbytes, -l) unlimited
> max memory size     (kbytes, -m) unlimited
> open files             (-n) 9182
> pipe size       (512 bytes, -p) 8
> stack size        (kbytes, -s) 8192
> cpu time         (seconds, -t) unlimited
> max user processes        (-u) 7168
> virtual memory     (kbytes, -v) unlimited
>
> But I can't find where the limits for each process/user are. One message
> found from google said PTHREAD_THREADS_MAX could be the max thread count
> per process. In my /usr/include/bits/local_lim.h, I have
>
> /* The number of threads per process. */
> #define _POSIX_THREAD_THREADS_MAX     64
> /* This is the value this implementation supports. */
> #define PTHREAD_THREADS_MAX   16384
>
> 16384 is large enough, I believe. Then what could be the reason of the
> error?
>
> By the way, the "Out of Memory" error didn't appear all the time.
> Sometimes there was just no response without any error message. Do you
> know where I can get more detailed bug files?
>
> Thank you very much.
>
> Qi
>
>
> On Sat, 6 Dec 2003, Tim Funk wrote:
>
>
>>When you get "java.lang.OutOfMemoryError: unable to create new native thread"
>>it means you are running into an operating system limit. You can give the JVM
>>1 Exabyte of memory and you'll still get this error.
>>
>>Look at the kernel parameters for your machine and the following limits:
>>1) Threads allowable on the system
>>2) Threads run by a user
>>3) Threads run by a process
>>4) File handles per process
>>5) File handles per user
>>
>>Use your OS manual or Google to tweak these parameters.
>>
>>http://jakarta.apache.org/tomcat/faq/memory.html#why
>>
>>-Tim
>>
>>qi zhang wrote:
>>
>>>Hi,
>>>
>>>I have stunk on this problem for almost 2 weeks. :-(
>>>In these two weeks, I have tried many methods, but it still doesn't work.
>>>
>>>I built a system to run TPCW benchmark. One web and application server,
>>>with tomcat4.0 running, one database with mysql4.0 running on it and
>>>several client machines. The Jave version is j2sdk1.4.0_03. The system
>>>worked perfect under light load. But when the number of clients
>>>exceeded some number (like 600), the tomcat4 didn't work anymore.
>>>I checked catalina.out. Sometimes no error message appear, while in some
>>>time it appeared the error:
>>>
>>>SEVERE: Caught exception executing
>>>org.apache.tomcat.util.net.TcpWorkerThread@(protected)
>>>java.lang.OutOfMemoryError: unable to create new native thread
>>>     at java.lang.Thread.start(Native Method)
>>>     at
>>>org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.<init>(ThreadPool.java:497)
>>>     at
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.