You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Crowther <pe...@melandra.com> on 2009/11/30 11:48:16 UTC

Re: How to solve the problem "java.lang.OutOfMemoryError: unable to create new native thread" in Tomcat5.5.26

2009/11/30 Peter Chen <pe...@aicent.com>:
> I meet one problem of OutOfMemoryError when I am running the
> Tomcat5.5.26. The OS is Solaris 10 sparc, and the JVM version is
> 1.5.0.12, and following is the detail of stack information.
>
> SEVERE: Caught exception (java.lang.OutOfMemoryError: unable to create
> new native thread) executing
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread@958b36,
>
> terminating thread
>
> Exception in thread "SIGTERM handler" java.lang.OutOfMemoryError: unable
> to create new native thread
>
>       at java.lang.Thread.start0(Native Method)
>       at java.lang.Thread.start(Thread.java:574)
>       at java.lang.Shutdown.runHooks(Shutdown.java:128)
>       at java.lang.Shutdown.sequence(Shutdown.java:173)
>       at java.lang.Shutdown.exit(Shutdown.java:218)
>       at java.lang.Terminator$1.handle(Terminator.java:35)
>       at sun.misc.Signal$1.run(Signal.java:195)
>       at java.lang.Thread.run(Thread.java:595)

OK, so this seems to happen at a very particular point: when you're
shutting down your server via SIGTERM (so killing the process).
Something has registered a shutdown hook, and the call to create the
thread to run the hooks is failing.

Does this always happen, or is it intermittent?  If it always happens,
presumably we'll very quickly know if we've found a fix, as you can
start the server, stop it, and see that the problem doesn't happen.

If it always happens, does increasing the amount of heap memory
assigned to the JVM help?  It might do if the JVM's very low on heap
memory.  Does *de*creasing the amount of heap memory help?  It might
do if the JVM's very low on non-heap memory, as creating a new thread
requires space for things like the thread's stack, which are not part
of the heap.

What options are you starting the JVM with, and how much RAM do you
have on the box?  I'm particularly interested in your heap and stack
sizes.

What connector options do you have set in your conf/server.xml?  I'm
particularly interested in the number of threads you have configured,
and hence how much heap and non-heap memory is being used for threads.

Sorry to request so much information, but OOMEs aren't always the
easiest to debug!

- Peter

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