tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Question about thread management
Date Fri, 11 Dec 2009 15:23:16 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

St├ęphane,

On 12/11/2009 4:48 AM, St├ęphane PURNELLE wrote:
> Server description :  tomcat 6.0.16, jdk 6.0.7 64-bits, RedHal EL 4.8 
> 64-bits, mod-jk enabled.

Whose JDK is that? 6.0.7 isn't a version number I recognize.

> On this server, we have 2 servlets managed by tomcat and some java 
> programs which run by cron.
> 
> all run fine except sometimes we have a java hotspot :
> 
> #
> # An unexpected error has been detected by Java Runtime Environment:
> #
> #  Internal Error (nmethod.cpp:1707), pid=7204, tid=1134967136
> #  Error: guarantee(cont_offset != 0,"unhandled implicit exception in 
> compiled code")
> #
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0-b23 mixed mode 
> linux-amd64)
> # If you would like to submit a bug report, please visit:
> #   http://java.sun.com/webapps/bugreport/crash.jsp
> #
> 
> and servlet hang.  We must restart tomcat.

This is a JVM crash unrelated to Tomcat itself. Try using the most
recent version of Sun's JRE/JDK, which is version 1.6.0_17.

> One of servlets contain more than 20 threads.

Technically speaking, servlets do not contain threads. Your servlet may
launch 20 threads and maintain references to them, but the servlet does
not "contain" the threads as it were. Did you mean that, in a thread
dump, you can see that 20 threads are doing work in the same servlet?

> The problem start when a java program (not a servlet) run.
> This program have two part and the second part start a thread.

Do you mean that a JVM running /not/ running Tomcat is crashing, and
this causes Tomcat to stop working? This sounds like an application
logic problem.

> We tried to avoid the program by change the cron time of program without 
> success.
> 
> and now, I would like to know if there are some parameters for manage the 
> number of thread supported by tomcat or java.

Java supports the number of threads allowed by the operating system for
the user running Tomcat. On linux, you can typically find out the limits
for threads using the 'ulimit' command (try the '-a' switch).

Tomcat can use as many threads as the OS/JVM will allow it to use.
Tomcat controls its own use of threads through the configuration of your
<Connector> elements in server.xml. The default for all connectors is a
maximum of 200 threads per connector (or executor, if you are using those).

> It's maybe a java problem, but how to ensure that tomcat will not hang by 
> a thread "overburn".

In any case, the JVM shouldn't be crashing. Try upgrading to a more
recent version of your JVM.

I'm not sure what you mean by "thread 'overburn'" but Tomcat shouldn't
hang for any reason other than your own webapp's code. Your code may be
infinitely blocked (all threads waiting for something that will never
happen) or deadlocked (all threads waiting on locks others hold: kind of
a special case of 'infinitely blocked') or caught in an infinite loop
(which you could see if your CPU had gone to 100%).

I would investigate the JVM crash, first. Once that's fixed, you can see
if there's anything else to do.

Good luck,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksiY+QACgkQ9CaO5/Lv0PCwoQCgmwOd6duX8T1qwcR7YNgsVwLW
JV8AoI1HVQ5OAbpDjvA/M13KTjqxmjPd
=BLXc
-----END PGP SIGNATURE-----

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


Mime
View raw message