tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Klop <ronald-mailingl...@base.nl>
Subject Re: AW: ThreadPool: Pool exhausted with 100 threads
Date Wed, 08 Sep 2004 11:28:16 GMT
Hi Matt,

Another option is this. If you do 'kill -QUIT <process-id>' on Linux or ctrl-break on
Windows in the dosbox running Java (if this is how you run Tomcat) it will print all stacktraces
of all threads. Very helpfull to track down lost Threads.

And another 'trick' I use is the following filter.

doFilter(request, response, chain) {
 Thread currThr = Thread.currentThread();
  String oldName = currThr.getName();
 try {
   currThr.setName(request.getRequestURI());
   chain.doFilter(request, response);
 } finally {
   currThr.setName(oldName);
 }
}

The jsp with the threadlist than displays the URL's which are being processed. Very helpfull.
But as far as I now Tomcat 3 doesn't support filters.

Greetings,

Ronald.

On Tue Sep 07 23:18:39 CEST 2004 Matt Robinson <matthewbrobinson@yahoo.com> wrote:
> Ronald, Thanks this is quite helpful - using your jsp
> I can see where we hit 100 threads and Tomcat freezes.
> 
> 
> As I monitor our systems the number of threads slowly
> grows until 100 is reached. The threads I see when
> monitoring (using your JSP page) are not closed --
> instead they seem to hang out until the 100 mark is
> reached (at which point we have to restart Tomcat).
> 
> In effort to avoid this, it looks like we'll be
> switching to 5.0.28 after some initial testing. Any
> further suggestions more than welcome
> 
> Thanks again,
> Matt
> 
> 
> --- Ronald Klop <ronald-mailinglist@base.nl> wrote:
> 
> >So, this is an error from the ThreadPool and not
> >from java or the OS. The errors I got we're errors
> >from the OS because of a limited nr of threads per
> >process. There are issues with the ThreadPool solved
> >in both 4 and 5 (see changelogs), so maybe this will
> >be solved for you also.
> > 
> >At my work I use a jsp which I will attach. It shows
> >all running threads and threadgroups by there name.
> >It gave me some usefull insight in the inner
> >workings of Tomcat.
> > 
> >Ronald.
> > 
> > 
> > 
> >On Tue Sep 07 07:08:10 CEST 2004 Matt Robinson
> ><matthewbrobinson@yahoo.com> wrote:
> >>Ronald,
> >> 
> >>The exact error message is "ThreadPool: Pool
> >exhausted
> >>with 100 threads", so I assume we have 100 threads
> >>running -- once this error message appears Tomcat
> >>stops responding until it is restarted. Is there a
> >>simple way to check # of threads in use by Tomcat
> >at
> >>any given time?
> >> 
> >>We are running Tomcat 3.2.4 and J2SE 1.4 on
> >Windows
> >>2000. Based on yours and other feedback, we plan
> >on
> >>upgrading to 4.x or 5.0 but not sure which is the
> >>right choice.
> >> 
> >>Thanks,
> >>Matt
> >> 
> >>--- Ronald Klop <ronald-mailinglist@base.nl>
> >wrote:
> >> 
> >>>On Mon Sep 06 00:40:14 CEST 2004 Matt Robinson
> >>><matthewbrobinson@yahoo.com> wrote:
> >>>>Steffen,
> >>>> 
> >>>>Many thanks for the response. The reason we
> >stuck
> >>>with
> >>>>3.2.4 was because of stability. However, as we
> >>>have
> >>>>become more successful our systems have been
> >>>receiving
> >>>>heavier loads and thus, the Threadpool exhausted
> >>>>problem.
> >>>> 
> >>>>Regarding stability/reliability (uptime is a
> >>>greater
> >>>>concern for us than performance), would you
> >>>recommend
> >>>>5.0 over 4.x or vice versa? 
> >>>> 
> >>>>Also curious if anyone has experienced thread
> >pool
> >>>>problems (or successes) with medium to high load
> >>>>systems under either 4.x or 5.0.
> >>>> 
> >>>>Thanks again,
> >>>>Matt
> >>>> 
> >>> 
> >>> 
> >>>How many threads do you have when it is exhausted
> >>>and what is the error message you get?
> >>>We are running Tomcat 5 with about hundred
> >threads
> >>>quite ok here. Tomcat 5 is much more efficient,
> >so
> >>>it can help you to try it out.
> >>> 
> >>>Ronald.
> >>> 
> >>> 
> >>> 
> >> 
> >> 
> >> 
> >> 
> >>__________________________________
> >>Do you Yahoo!?
> >>Read only the mail you want - Yahoo! Mail
> >SpamGuard.
> >>http://promotions.yahoo.com/new_mail 
> >> 
> >>
> >
> ---------------------------------------------------------------------
> >>To unsubscribe, e-mail:
> >tomcat-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail:
> >tomcat-user-help@jakarta.apache.org
> >> 
> > 
> >><%@ page
> >info = "$Id: threads.jsp,v 1.2 2003/05/26 19:24:55
> >ronald Exp $"
> >import = "
> >java.util.Calendar,
> >java.util.TimeZone
> >"
> >%>
> ><%!
> >class Group {
> >JspWriter out;
> >Group(JspWriter out) {
> >this.out = out;
> >}
> >void print(ThreadGroup tg, String prefix) throws
> >java.io.IOException {
> >int i;
> >out.println(prefix + "G " + tg.getName());
> >ThreadGroup[] tga = new
> >ThreadGroup[tg.activeGroupCount()];
> >int nr = tg.enumerate(tga, false);
> >for(i = 0; i < nr; i++) {
> >this.print(tga[i], prefix + "\t");
> >}
> >Thread[] ta = new Thread[tg.activeCount()];
> >nr = tg.enumerate(ta, false);
> >String[] names = new String[nr];
> >for(i = 0; i < names.length; i++) {
> >names[i] = ta[i].getName();
> >}
> >java.util.Arrays.sort(names);
> >for(i = 0; i < nr; i++) {
> >out.println(prefix + "T " + names[i]);
> >}
> >}
> >}
> >%>
> ><html>
> ><head>
> ><%@ include file="/pub/exec/baseDHTML.jspf" %>
> ><!-- <%=getServletInfo()%> -->
> ><title>Threads -
> ><%=request.getServerName()%></title>
> ></head>
> ><body>
> ><%
> >java.util.Date now =
> >
> Calendar.getInstance(TimeZone.getTimeZone("Europe/Amsterdam")).getTime();
> >%>
> >Time: <%=now.toString()%><br/>
> ><pre>
> ><%
> >Thread current = Thread.currentThread();
> >ThreadGroup tg = current.getThreadGroup();
> >while(tg.getParent() != null) {
> >tg = tg.getParent();
> >}
> >Group g = new Group(out);
> >g.print(tg, "");
> >%>
> ></pre>
> ></body>
> ></html>
> > 
> >>
> ---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> >tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message