You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Dan Higgins <Da...@austin.rr.com> on 2003/02/01 23:13:23 UTC

Tomcat 4.0.6 leaving CLOSE_WAIT sockets

Hi,

I have a script which can burst any number of async socket connections to
Tomcat from a remote host. With it, I can get every available connector
processor thread to become busy at once. At that point, Tomcat simply
refuses any new socket connections at all.

Ok, this is to be expected. But the problem is, ALL the threads seem to
leave their sockets in the CLOSE_WAIT state, never actually closing them.
Tomcat then seems to refuse any new connections until it is restarted.

This is an issue because I am seeing it on a production server with
maxProcessors set to 600. It could be a targeted DoS attack, or it could
just be huge spikes in load at certain times. Either way, Tomcat is not
faring very well.

This has been driving me batty for about a week now. Any advice or ideas?

(Tomcat 4.0.6, Windows 2000 Server SP3, Sun JDK 1.4.1_01)

-Dan


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


SOLVED RE: Tomcat 4.0.6 leaving CLOSE_WAIT sockets

Posted by Dan Higgins <Da...@austin.rr.com>.
Hi again,

It looks like it was a bug in my JDBC driver.  Sorry to doubt you marvelous
Tomcat developers of the world.

Cheers,
-Dan


> -----Original Message-----
> From: Dan Higgins [mailto:DanHiggins@austin.rr.com]
> Sent: Saturday, February 01, 2003 6:59 PM
> To: Tomcat-Dev
> Subject: RE: Tomcat 4.0.6 leaving CLOSE_WAIT sockets
>
>
> Hi Again,
>
> This is not all Tomcat's fault. I have narrowed it down to JSP's
> that actually make a JDBC connection.
>
> For static (.html) files and JSP's that don't connect to a db,
> the CLOSE_WAIT problem does NOT seem to occur.
>
> I know that EJB's would be the proper way to access persistent
> data from JSP's, but for this particular site I don't have that luxury.
>
> I suspect this problem stems from all connector threads using a
> single java.sql.Connection object stored in the app context. If I
> wanted each thread to have its own Connection, how could I do
> that?  If it's OK to use one Connection object for an entire
> webapp, then I'll check for bugs in my JDBC driver...
>
> IMHO, if this is NOT a bug in my JDBC driver, then it probably
> really is a problem with Tomcat -- sockets simply shouldn't be
> left in CLOSE_WAIT by an application.
>
> Thanks,
> -Dan
>
>
> > -----Original Message-----
> > From: Dan Higgins [mailto:DanHiggins@austin.rr.com]
> > Sent: Saturday, February 01, 2003 4:13 PM
> > To: Tomcat-Dev
> > Subject: Tomcat 4.0.6 leaving CLOSE_WAIT sockets
> >
> >
> > Hi,
> >
> > I have a script which can burst any number of async socket
> > connections to Tomcat from a remote host. With it, I can get
> > every available connector processor thread to become busy at
> > once. At that point, Tomcat simply refuses any new socket
> > connections at all.
> >
> > Ok, this is to be expected. But the problem is, ALL the threads
> > seem to leave their sockets in the CLOSE_WAIT state, never
> > actually closing them. Tomcat then seems to refuse any new
> > connections until it is restarted.
> >
> > This is an issue because I am seeing it on a production server
> > with maxProcessors set to 600. It could be a targeted DoS attack,
> > or it could just be huge spikes in load at certain times. Either
> > way, Tomcat is not faring very well.
> >
> > This has been driving me batty for about a week now. Any advice
> or ideas?
> >
> > (Tomcat 4.0.6, Windows 2000 Server SP3, Sun JDK 1.4.1_01)
> >
> > -Dan


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


RE: Tomcat 4.0.6 leaving CLOSE_WAIT sockets

Posted by Dan Higgins <Da...@austin.rr.com>.
Hi Again,

This is not all Tomcat's fault. I have narrowed it down to JSP's that
actually make a JDBC connection.

For static (.html) files and JSP's that don't connect to a db, the
CLOSE_WAIT problem does NOT seem to occur.

I know that EJB's would be the proper way to access persistent data from
JSP's, but for this particular site I don't have that luxury.

I suspect this problem stems from all connector threads using a single
java.sql.Connection object stored in the app context. If I wanted each
thread to have its own Connection, how could I do that?  If it's OK to use
one Connection object for an entire webapp, then I'll check for bugs in my
JDBC driver...

IMHO, if this is NOT a bug in my JDBC driver, then it probably really is a
problem with Tomcat -- sockets simply shouldn't be left in CLOSE_WAIT by an
application.

Thanks,
-Dan


> -----Original Message-----
> From: Dan Higgins [mailto:DanHiggins@austin.rr.com]
> Sent: Saturday, February 01, 2003 4:13 PM
> To: Tomcat-Dev
> Subject: Tomcat 4.0.6 leaving CLOSE_WAIT sockets
>
>
> Hi,
>
> I have a script which can burst any number of async socket
> connections to Tomcat from a remote host. With it, I can get
> every available connector processor thread to become busy at
> once. At that point, Tomcat simply refuses any new socket
> connections at all.
>
> Ok, this is to be expected. But the problem is, ALL the threads
> seem to leave their sockets in the CLOSE_WAIT state, never
> actually closing them. Tomcat then seems to refuse any new
> connections until it is restarted.
>
> This is an issue because I am seeing it on a production server
> with maxProcessors set to 600. It could be a targeted DoS attack,
> or it could just be huge spikes in load at certain times. Either
> way, Tomcat is not faring very well.
>
> This has been driving me batty for about a week now. Any advice or ideas?
>
> (Tomcat 4.0.6, Windows 2000 Server SP3, Sun JDK 1.4.1_01)
>
> -Dan


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