I got "Open too many files" error when I set the max open files 4096, so
that I changed it to 9182. But I think no matter how large it is, it won't
affect the performace, right?

I'm not good at Java. But I don't think I reloaded the classes in Tomcat
manager. I didn't change web.xml. Is it the problem?

Now the problem is more and more confusing. I used "-verbosegc" to log GC
behavior and the memory usage. If I set CATALINA_OPTS="-server -Xmx1200M
-Xms1200M -Xss256k", I got OutOfMemory error quickly as
################################
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
org.apache.tomcat.util.threads.ThreadPool.openThreads(ThreadPool.java:387)
        at
org.apache.tomcat.util.threads.ThreadPool.runIt(ThreadPool.java:226)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:503)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
        at java.lang.Thread.run(Thread.java:536)
[GC 338409K->282510K(1215168K), 0.3190985 secs]
################################

While if I set CATALINA_OPTS="-server -Xmx768M -Xms768M -Xss256k", I didn't
get any error message in catalina.out. But tomcat stopped, and I got "Time
Out" in browser. The final line in catalina.out was
########################################
[GC 412489K->360388K(777728K), 0.1470509 secs]
########################################

Then I stopped tomcat4, and got the following error message in catalina.out.
#########################################
Java HotSpot(TM) Server VM warning: Attempt to unguard stack red zone failed.
An irrecoverable stack overflow has occurred.

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x40039203
Function=(null)+0x40039203
Library=/lib/libpthread.so.0

NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.
#########################################

I'm wondering if it is not good to set too large heap file size, which may
limit other required space. I am really confused about why tomcat stopped
without any error message. How can I find the error? Did anybody meet this
problem before?

Thank you very much.

Qi

>Look at the open files  - it is 9182.  That IS already pretty high, but
>you may be hitting that limit since in Unix, everything is a file.
>Sockets, etc.

>On Linux, is there a way in the JVM to tell the difference between
>memory given to the new generation, old generation, and permanent
>generation in the JVM?  There were users on this list posting weird
>OutOfMemory errors last week that were doing class reloading, and the
>permanent generation was filling up even though there was plenty of
>space in the old and new gen.  Of course, I think these comments only
>apply to a 1.4.x JVM.  Does your code do funky stuff with the
>classloaders, or are you reloading your application in Tomcat's manager?
> (or changing web.xml, which would cause reloads??)

>Have you profiled your application to find any memory leaks?


> 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
>>>>[EMAIL PROTECTED], terminating thread
>>>> 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: [EMAIL PROTECTED] For
> additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to