You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jon Skeet <jo...@peramon.com> on 2000/11/17 17:28:50 UTC

Requesting / hangs Tomcat with no static interceptor?

I'm using Tomcat 3.2b7 (also happens under 3.2b6) and I'm trying to run
a slightly cut-down version. In particular, I don't want to serve any static
files, show any directories etc.

I thought that to do this, I could remove the line:

<RequestInterceptor className="org.apache.tomcat.request.StaticInterceptor" />

from server.xml.

Unfortunately, this seems to mean that a request for / on the server sends
Tomcat into a tight loop (Java takes up 99% of my CPU).

Any ideas? Is removing the StaticInterceptor just a really bad idea?

Win2K, JDK1.3 btw.

Jon

Re: Requesting / hangs Tomcat with no static interceptor?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Kurt Bernhard Pruenner wrote:

> "Craig R. McClanahan" wrote:
> > Jon Skeet wrote:
> > > Unfortunately, this seems to mean that a request for / on the server sends
> > > Tomcat into a tight loop (Java takes up 99% of my CPU).
> >
> > The static interceptor also interprets requests for welcome files (which is
> > what you really want to have happen when you ask for URL "/"), so removing
> > it is probably not a good idea :-).
>
> Errr, Craig... I don't think that using up all CPU time if no interceptor
> wants to be responsible for a URL is any good, either... :)
>
> Shouldn't this behaviour be called a bug as well?
>

For me it only looped for a moment, and then returned a 404 error.  It did not
stay stuck even long enough to peg my CPU meter, which was set on a 5 second
interval, before it finally completed the request and returned.

One other thing that can cause what appear to be CPU lockups is the very first
time you make a request that creates a session.  The random number generator is
initialized, which can take many seconds of 100% CPU usage depending on your
server.

The static interceptor is configured separately so that it can be replaced, not so
that it can be removed (unlike some of the other interceptors which represent
optional functionality).  It is fundamental functionality that you should consider
to be an integral part of Tomcat.

> Kurt Pruenner - Haendelstrasse 17, 4020 Linz, Austria | Briareos at Olymp BBS:

Craig McClanahan



Re: Requesting / hangs Tomcat with no static interceptor?

Posted by Kurt Bernhard Pruenner <le...@gmx.at>.
"Craig R. McClanahan" wrote:
> Jon Skeet wrote:
> > Unfortunately, this seems to mean that a request for / on the server sends
> > Tomcat into a tight loop (Java takes up 99% of my CPU).
>
> The static interceptor also interprets requests for welcome files (which is 
> what you really want to have happen when you ask for URL "/"), so removing 
> it is probably not a good idea :-).

Errr, Craig... I don't think that using up all CPU time if no interceptor
wants to be responsible for a URL is any good, either... :)

Shouldn't this behaviour be called a bug as well?

-- 
Kurt Pruenner - Haendelstrasse 17, 4020 Linz, Austria | Briareos at Olymp BBS:
http://www.mp3.com/Leak http://www.ssw.uni-linz.ac.at | ssh bbs@138.232.112.32
...........It might be written "Mindfuck", but it's spelt "L-A-I-N"...........
np: Leak - Drevil (Leaked)

Re: Requesting / hangs Tomcat with no static interceptor?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jon Skeet wrote:

> I'm using Tomcat 3.2b7 (also happens under 3.2b6) and I'm trying to run
> a slightly cut-down version. In particular, I don't want to serve any static
> files, show any directories etc.
>
> I thought that to do this, I could remove the line:
>
> <RequestInterceptor className="org.apache.tomcat.request.StaticInterceptor" />
>
> from server.xml.
>
> Unfortunately, this seems to mean that a request for / on the server sends
> Tomcat into a tight loop (Java takes up 99% of my CPU).
>
> Any ideas? Is removing the StaticInterceptor just a really bad idea?
>
> Win2K, JDK1.3 btw.
>

The static interceptor also interprets requests for welcome files (which is what
you really want to have happen when you ask for URL "/"), so removing it is
probably not a good idea :-).

In 3.2b7 there is a configuration option on the static interceptor to disable
directory listings.  The default entry looks like this:

    <RequestInterceptor
        className="org.apache.tomcat.request.StaticInterceptor"
        debug="0" suppress="false" />

Change the suppress attribute to true, and Tomcat will return an error instead of
a directory listing when no welcome file is present.

>
> Jon

Craig McClanahan