You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Neil Aggarwal <ne...@JAMMConsulting.com> on 2003/12/22 05:46:36 UTC

Tomcat threading questions

Hello:

I have a couple of questions about the way Tomcat uses threads:

1. If a thread does an infinite loop or other operation that
	would cause it to wait forever, will Tomcat kill it?
	If not, is there a way to do that?
	If so, how would we control the timeout?

2. Is there a hard limit on the number of threads like in
	Apache or does it allocate up to maxProcessors no matter
	how large it may be?

Thanks,
	Neil


--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by 
17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com


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


RE: Tomcat threading questions

Posted by Neil Aggarwal <ne...@JAMMConsulting.com>.
Bill:

> Eventually the browser will drop the connection, and then if 
> the Servlet
> tries to write anything, then an IOException will be thrown.  However
> allowing the following code on your server will DoS:
>   while(true) {
>      Thread.Sleep(1000);
>   }

This is precisely my question:  Is there a way to set a 
timeout on a thread and kill it if it takes that amount of time?

> The thread allocation is pretty similar to Apache/httpd.

The Apache server source code has a hard thread limit defined
in the source code.  Does Tomcat?

Thanks,
	Neil

--
Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
FREE! Valuable info on how your business can reduce operating costs by 
17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com


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


Re: Tomcat threading questions

Posted by Bill Barker <wb...@wilshire.com>.
"Neil Aggarwal" <ne...@JAMMConsulting.com> wrote in message
news:000001c3c846$960790d0$0302a8c0@dell5100...
> Hello:
>
> I have a couple of questions about the way Tomcat uses threads:
>
> 1. If a thread does an infinite loop or other operation that
> would cause it to wait forever, will Tomcat kill it?
> If not, is there a way to do that?
> If so, how would we control the timeout?

Eventually the browser will drop the connection, and then if the Servlet
tries to write anything, then an IOException will be thrown.  However
allowing the following code on your server will DoS:
  while(true) {
     Thread.Sleep(1000);
  }


>
> 2. Is there a hard limit on the number of threads like in
> Apache or does it allocate up to maxProcessors no matter
> how large it may be?
>

The thread allocation is pretty similar to Apache/httpd.

> Thanks,
> Neil
>
>
> --
> Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com
> FREE! Valuable info on how your business can reduce operating costs by
> 17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com




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