You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by gtallen <gt...@home.com> on 2000/04/15 06:41:45 UTC

Tomcat Thread Pools

Hi,
I've been doing some testing of both the RC1 and the source
with the thread pools and have run into some problems and
questions (BTW: what a great piece of work Tomcat developers).


First, if I don't have a "Ajp12ConnectionHandler" connector defined then
I can't
shut Tomcat down since Tomcat uses this to handler to stop itself.  So,
I guess we
always must have this "Ajp12ConnectionHandler" handler defined?  It
appears to be
true based on my view of the source, is this intentional?


Second, are there minimum and maximum values for the max_threads,
max_spare_threads,
and min_spare_threads other than zero?  If I set them all to (1) then
Tomcat will not
start, do they need to be in any particular ratio.


Third, how robust is the "PoolTcpConnector" and has anyone used it
extensively?


Fourth, minor problem.
If I start Tomcat and then shut it down with
the following Connector definition:
=================================================================================
<Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"
value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8007"/>
              <Parameter name="max_threads" value="30"/>
          <Parameter name="max_spare_threads" value="20"/>
          <Parameter name="min_spare_threads" value="5"/>
</Connector>
==================================================================================
I get:
Starting tcp endpoint on 8007 with
org.apache.tomcat.service.connector.Ajp12ConnectionHandler
java.lang.ArrayIndexOutOfBoundsException: 3 >= 3
Signal ignored: 15
HANDLER THREAD PROBLEM: java.lang.NullPointerException:
java.lang.NullPointerException:
        at
org.apache.tomcat.service.connector.AJP12ResponseAdapter.sendStatus(Ajp12ConnectionHandler.java:439)
        at
org.apache.tomcat.service.http.HttpResponseAdapter.endHeaders(HttpResponseAdapter.java,
Compiled Code)
        at
org.apache.tomcat.core.BufferedServletOutputStream.sendHeaders(BufferedServletOutputStream.java:127)
        at
org.apache.tomcat.core.BufferedServletOutputStream.reallyFlush(BufferedServletOutputStream.java:239)
        at
org.apache.tomcat.core.ResponseImpl.finish(ResponseImpl.java:178)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:158)
        at
org.apache.tomcat.service.TcpWorkerThread.run(PoolTcpEndpoint.java,
Compiled Code)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
        at java.lang.Thread.run(Thread.java:479)
=====================================================================================
Because "sout" is not checked for null in the following class
===================================================================================
class AJP12ResponseAdapter extends HttpResponseAdapter {
    /** Override setStatus
     */
    protected void sendStatus( int status, String message)  throws
IOException {
 statusSB.setLength(0);
 statusSB.append("Status: " ).append( status ).append("
").append(message).append("\r\n");
 if(sout == null)
  System.out.println("NULL stream=======================");
 sout.write(statusSB.toString().getBytes());
    }
}

Re: Tomcat Thread Pools

Posted by gtallen <gt...@home.com>.
Thanks!  I'm going to try pounding them on different
platforms and with different configurations, so I'll
let you know how it all fares.
Greg

Shachor Gal wrote:
> 
> Thanks for the bug reports, fixed.
> 
> >
> > Second, are there minimum and maximum values for the max_threads,
> > max_spare_threads,
> > and min_spare_threads other than zero?  If I set them all to (1) then
> > Tomcat will not
> > start, do they need to be in any particular ratio.
> >
> 
> Yep,
> 
> max_threads >= 2 >= max_spare_threads >= min_spare_threads >= 1
> 
> But it was not documented and even worst not checked enough.
> 
> >
> > Third, how robust is the "PoolTcpConnector" and has anyone used it
> > extensively?
> >
> 
> Hard to know, I use it all the time (yet I do not use startup and shutdown
> :)) and has no problems (but I am biased right?)
> 
>         Gal Shachor
> 
> 
> --------------------------------------------------------------------------
> To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commmands, email: tomcat-user-help@jakarta.apache.org

Re: Tomcat Thread Pools

Posted by Shachor Gal <sh...@techunix.technion.ac.il>.
Thanks for the bug reports, fixed.

> 
> Second, are there minimum and maximum values for the max_threads,
> max_spare_threads,
> and min_spare_threads other than zero?  If I set them all to (1) then
> Tomcat will not
> start, do they need to be in any particular ratio.
>

Yep,

max_threads >= 2 >= max_spare_threads >= min_spare_threads >= 1

But it was not documented and even worst not checked enough.
  
> 
> Third, how robust is the "PoolTcpConnector" and has anyone used it
> extensively?
> 

Hard to know, I use it all the time (yet I do not use startup and shutdown
:)) and has no problems (but I am biased right?)

	Gal Shachor