You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stéphane PURNELLE <st...@corman.be> on 2009/12/11 10:48:31 UTC

Question about thread management

Hi all,

Server description :  tomcat 6.0.16, jdk 6.0.7 64-bits, RedHal EL 4.8 
64-bits, mod-jk enabled.

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.


One of servlets contain more than 20 threads.
The other servlet is developed by a external society and I don't know what 
this servlet do.

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

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.
It's maybe a java problem, but how to ensure that tomcat will not hang by 
a thread "overburn".

Thanks

        Stéphane Purnelle


-----------------------------------
Stéphane PURNELLE                         Admin. Systèmes et Réseaux 
Service Informatique       Corman S.A.           Tel : 00 32 (0)87/342467

RE: Question about thread management

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Stéphane PURNELLE [mailto:stephane.purnelle@corman.be]
> Subject: Question about thread management
> 
> Server description :  tomcat 6.0.16, jdk 6.0.7 64-bits, RedHal EL 4.8
> 64-bits, mod-jk enabled.
> 
> #
> # 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")

Pure Java code cannot cause such a crash in the JVM; the problem is either in the JVM itself, or in any native code you might have in your webapps.  Since your JVM is a bit old (current version is 6u17), you might want to try upgrading that.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: Question about thread management

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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