You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@yahoo.com on 2001/08/21 20:05:08 UTC

imap close_wait with Tomcat 3.2.1

I am running a production server with Apache 1.3.14
and Tomcat 3.2.1. I have developed a
JSP-JavaBeans-Based WebMail that runs on this RH Linux
7.1 server.

While debuging I noticed that if I logout of the
webmail (click logout) I see the connection to the
imap server being closed. But somehow, after several
users accessing the site, I notice, using netstat -a
imap, there is a growning number of close_wait
sockets. Eventually I get a connection failure
exception if I try to login. That is because there are
no more sockets available to the server.  

I read here and there that for some reason Tomcat is
not releasing those sockets. Does it have to do with
the possibility that some users just close the browser
instead of pressing logout? 

When I stop and start Tomcat I notice that all the
close_wait sockets are released. Which makes me feel
it is a problem with my code/Tomcat's.

By any means how can I fix this problem. It is getting
irritating to repeatedly stop and start tomcat
whenever I get that exception.

With the site load growing I am affraid that the
server will crash every 5 minutes. Now I have to
restart every other day.

Thanks in advance.

Lumi

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

RE: imap close_wait with Tomcat 3.2.1

Posted by lu...@yahoo.com.
Thank you for your assistance and I apologize for
dumping on your.

Lumi.

PS: Is there a reference to any material about how
many people are using Tomcat on production? And what
is a best-practice for fine tuning Tomcat for
highloads?

--- Marc Saegesser <ma...@apropos.com> wrote:
> I've never dealt with the JavaMail API so I can't
> really give you any
> details.  I'm sure there are more appropriate forums
> for discussing those
> issues.
> 
> The sockets are going away when you stop Tomcat for
> one of two reasons.
> First, there's code in your servlets' destroy()
> method that is actively
> closing the connections or the VM is forcefully
> closing them as it shuts
> down.
> 
> I would guess (and this really is a guess because
> I've never used JavaMail
> or IMAP) that the IMAP server is shutting down the
> connection from its side,
> say for inactivity, and you're still holding on to a
> reference to some
> object on your side that's holding open the client
> half of the socket.  At
> any rate, this isn't a topic that's relevant to
> tomcat-dev.
> 
> Marc Saegesser
> 
> > -----Original Message-----
> > From: luminousheart@yahoo.com
> [mailto:luminousheart@yahoo.com]
> > Sent: Tuesday, August 21, 2001 1:52 PM
> > To: tomcat-dev@jakarta.apache.org
> > Subject: RE: imap close_wait with Tomcat 3.2.1
> >
> >
> > Hi,
> > Thank you Marc for your reply.
> >
> > As a matter of fact I am using JavaMail API to
> handle
> > my communication to the IMAP server. So all the
> lower
> > level sockets, etc., are transparent to me.
> >
> > Is there a way I can look at this? And why do I
> see
> > the sockets being released once I shutdonw Tomcat?
> >
> > Thanks.
> > Lumi.
> >
> > --- Marc Saegesser <ma...@apropos.com>
> wrote:
> > > A socket enters the CLOSE_WAIT state when it
> > > receives a FIN packet from the
> > > other side.  It remains in this state until the
> > > application issues a close()
> > > on the socket.  At that point a FIN packet is
> sent
> > > and the socket enters the
> > > LAST_ACK state until the associated ACK packet
> is
> > > received.  The Stevens
> > > _TCP/IP Illustrated, Volume 1_ book is almost
> > > required reading for anyone
> > > doing TCP/IP programming.
> > >
> > > I don't think this is a Tomcat problem, but most
> > > likely something in your
> > > servlet code that isn't properly closing down
> the
> > > connections to the IMAP
> > > server (or more probably, not handling the
> situation
> > > where the IMAP server
> > > closes its end of the connection).
> > >
> > >
> > > Marc Saegesser
> > >
> > > > -----Original Message-----
> > > > From: luminousheart@yahoo.com
> > > [mailto:luminousheart@yahoo.com]
> > > > Sent: Tuesday, August 21, 2001 1:05 PM
> > > > To: tomcat-dev@jakarta.apache.org
> > > > Subject: imap close_wait with Tomcat 3.2.1
> > > >
> > > >
> > > > I am running a production server with Apache
> > > 1.3.14
> > > > and Tomcat 3.2.1. I have developed a
> > > > JSP-JavaBeans-Based WebMail that runs on this
> RH
> > > Linux
> > > > 7.1 server.
> > > >
> > > > While debuging I noticed that if I logout of
> the
> > > > webmail (click logout) I see the connection to
> the
> > > > imap server being closed. But somehow, after
> > > several
> > > > users accessing the site, I notice, using
> netstat
> > > -a
> > > > imap, there is a growning number of close_wait
> > > > sockets. Eventually I get a connection failure
> > > > exception if I try to login. That is because
> there
> > > are
> > > > no more sockets available to the server.
> > > >
> > > > I read here and there that for some reason
> Tomcat
> > > is
> > > > not releasing those sockets. Does it have to
> do
> > > with
> > > > the possibility that some users just close the
> > > browser
> > > > instead of pressing logout?
> > > >
> > > > When I stop and start Tomcat I notice that all
> the
> > > > close_wait sockets are released. Which makes
> me
> > > feel
> > > > it is a problem with my code/Tomcat's.
> > > >
> > > > By any means how can I fix this problem. It is
> > > getting
> > > > irritating to repeatedly stop and start tomcat
> > > > whenever I get that exception.
> > > >
> > > > With the site load growing I am affraid that
> the
> > > > server will crash every 5 minutes. Now I have
> to
> > > > restart every other day.
> > > >
> > > > Thanks in advance.
> > > >
> > > > Lumi
> > > >
> > > >
> __________________________________________________
> > > > Do You Yahoo!?
> > > > Make international calls for as low as
> $.04/minute
> > > with Yahoo! Messenger
> > > > http://phonecard.yahoo.com/
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> 


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

RE: imap close_wait with Tomcat 3.2.1

Posted by Marc Saegesser <ma...@apropos.com>.
I've never dealt with the JavaMail API so I can't really give you any
details.  I'm sure there are more appropriate forums for discussing those
issues.

The sockets are going away when you stop Tomcat for one of two reasons.
First, there's code in your servlets' destroy() method that is actively
closing the connections or the VM is forcefully closing them as it shuts
down.

I would guess (and this really is a guess because I've never used JavaMail
or IMAP) that the IMAP server is shutting down the connection from its side,
say for inactivity, and you're still holding on to a reference to some
object on your side that's holding open the client half of the socket.  At
any rate, this isn't a topic that's relevant to tomcat-dev.

Marc Saegesser

> -----Original Message-----
> From: luminousheart@yahoo.com [mailto:luminousheart@yahoo.com]
> Sent: Tuesday, August 21, 2001 1:52 PM
> To: tomcat-dev@jakarta.apache.org
> Subject: RE: imap close_wait with Tomcat 3.2.1
>
>
> Hi,
> Thank you Marc for your reply.
>
> As a matter of fact I am using JavaMail API to handle
> my communication to the IMAP server. So all the lower
> level sockets, etc., are transparent to me.
>
> Is there a way I can look at this? And why do I see
> the sockets being released once I shutdonw Tomcat?
>
> Thanks.
> Lumi.
>
> --- Marc Saegesser <ma...@apropos.com> wrote:
> > A socket enters the CLOSE_WAIT state when it
> > receives a FIN packet from the
> > other side.  It remains in this state until the
> > application issues a close()
> > on the socket.  At that point a FIN packet is sent
> > and the socket enters the
> > LAST_ACK state until the associated ACK packet is
> > received.  The Stevens
> > _TCP/IP Illustrated, Volume 1_ book is almost
> > required reading for anyone
> > doing TCP/IP programming.
> >
> > I don't think this is a Tomcat problem, but most
> > likely something in your
> > servlet code that isn't properly closing down the
> > connections to the IMAP
> > server (or more probably, not handling the situation
> > where the IMAP server
> > closes its end of the connection).
> >
> >
> > Marc Saegesser
> >
> > > -----Original Message-----
> > > From: luminousheart@yahoo.com
> > [mailto:luminousheart@yahoo.com]
> > > Sent: Tuesday, August 21, 2001 1:05 PM
> > > To: tomcat-dev@jakarta.apache.org
> > > Subject: imap close_wait with Tomcat 3.2.1
> > >
> > >
> > > I am running a production server with Apache
> > 1.3.14
> > > and Tomcat 3.2.1. I have developed a
> > > JSP-JavaBeans-Based WebMail that runs on this RH
> > Linux
> > > 7.1 server.
> > >
> > > While debuging I noticed that if I logout of the
> > > webmail (click logout) I see the connection to the
> > > imap server being closed. But somehow, after
> > several
> > > users accessing the site, I notice, using netstat
> > -a
> > > imap, there is a growning number of close_wait
> > > sockets. Eventually I get a connection failure
> > > exception if I try to login. That is because there
> > are
> > > no more sockets available to the server.
> > >
> > > I read here and there that for some reason Tomcat
> > is
> > > not releasing those sockets. Does it have to do
> > with
> > > the possibility that some users just close the
> > browser
> > > instead of pressing logout?
> > >
> > > When I stop and start Tomcat I notice that all the
> > > close_wait sockets are released. Which makes me
> > feel
> > > it is a problem with my code/Tomcat's.
> > >
> > > By any means how can I fix this problem. It is
> > getting
> > > irritating to repeatedly stop and start tomcat
> > > whenever I get that exception.
> > >
> > > With the site load growing I am affraid that the
> > > server will crash every 5 minutes. Now I have to
> > > restart every other day.
> > >
> > > Thanks in advance.
> > >
> > > Lumi
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Make international calls for as low as $.04/minute
> > with Yahoo! Messenger
> > > http://phonecard.yahoo.com/
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/


RE: imap close_wait with Tomcat 3.2.1

Posted by lu...@yahoo.com.
Hi,
Thank you Marc for your reply.

As a matter of fact I am using JavaMail API to handle
my communication to the IMAP server. So all the lower
level sockets, etc., are transparent to me. 

Is there a way I can look at this? And why do I see
the sockets being released once I shutdonw Tomcat?

Thanks.
Lumi.

--- Marc Saegesser <ma...@apropos.com> wrote:
> A socket enters the CLOSE_WAIT state when it
> receives a FIN packet from the
> other side.  It remains in this state until the
> application issues a close()
> on the socket.  At that point a FIN packet is sent
> and the socket enters the
> LAST_ACK state until the associated ACK packet is
> received.  The Stevens
> _TCP/IP Illustrated, Volume 1_ book is almost
> required reading for anyone
> doing TCP/IP programming.
> 
> I don't think this is a Tomcat problem, but most
> likely something in your
> servlet code that isn't properly closing down the
> connections to the IMAP
> server (or more probably, not handling the situation
> where the IMAP server
> closes its end of the connection).
> 
> 
> Marc Saegesser
> 
> > -----Original Message-----
> > From: luminousheart@yahoo.com
> [mailto:luminousheart@yahoo.com]
> > Sent: Tuesday, August 21, 2001 1:05 PM
> > To: tomcat-dev@jakarta.apache.org
> > Subject: imap close_wait with Tomcat 3.2.1
> >
> >
> > I am running a production server with Apache
> 1.3.14
> > and Tomcat 3.2.1. I have developed a
> > JSP-JavaBeans-Based WebMail that runs on this RH
> Linux
> > 7.1 server.
> >
> > While debuging I noticed that if I logout of the
> > webmail (click logout) I see the connection to the
> > imap server being closed. But somehow, after
> several
> > users accessing the site, I notice, using netstat
> -a
> > imap, there is a growning number of close_wait
> > sockets. Eventually I get a connection failure
> > exception if I try to login. That is because there
> are
> > no more sockets available to the server.
> >
> > I read here and there that for some reason Tomcat
> is
> > not releasing those sockets. Does it have to do
> with
> > the possibility that some users just close the
> browser
> > instead of pressing logout?
> >
> > When I stop and start Tomcat I notice that all the
> > close_wait sockets are released. Which makes me
> feel
> > it is a problem with my code/Tomcat's.
> >
> > By any means how can I fix this problem. It is
> getting
> > irritating to repeatedly stop and start tomcat
> > whenever I get that exception.
> >
> > With the site load growing I am affraid that the
> > server will crash every 5 minutes. Now I have to
> > restart every other day.
> >
> > Thanks in advance.
> >
> > Lumi
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> 


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

RE: imap close_wait with Tomcat 3.2.1

Posted by Marc Saegesser <ma...@apropos.com>.
A socket enters the CLOSE_WAIT state when it receives a FIN packet from the
other side.  It remains in this state until the application issues a close()
on the socket.  At that point a FIN packet is sent and the socket enters the
LAST_ACK state until the associated ACK packet is received.  The Stevens
_TCP/IP Illustrated, Volume 1_ book is almost required reading for anyone
doing TCP/IP programming.

I don't think this is a Tomcat problem, but most likely something in your
servlet code that isn't properly closing down the connections to the IMAP
server (or more probably, not handling the situation where the IMAP server
closes its end of the connection).


Marc Saegesser

> -----Original Message-----
> From: luminousheart@yahoo.com [mailto:luminousheart@yahoo.com]
> Sent: Tuesday, August 21, 2001 1:05 PM
> To: tomcat-dev@jakarta.apache.org
> Subject: imap close_wait with Tomcat 3.2.1
>
>
> I am running a production server with Apache 1.3.14
> and Tomcat 3.2.1. I have developed a
> JSP-JavaBeans-Based WebMail that runs on this RH Linux
> 7.1 server.
>
> While debuging I noticed that if I logout of the
> webmail (click logout) I see the connection to the
> imap server being closed. But somehow, after several
> users accessing the site, I notice, using netstat -a
> imap, there is a growning number of close_wait
> sockets. Eventually I get a connection failure
> exception if I try to login. That is because there are
> no more sockets available to the server.
>
> I read here and there that for some reason Tomcat is
> not releasing those sockets. Does it have to do with
> the possibility that some users just close the browser
> instead of pressing logout?
>
> When I stop and start Tomcat I notice that all the
> close_wait sockets are released. Which makes me feel
> it is a problem with my code/Tomcat's.
>
> By any means how can I fix this problem. It is getting
> irritating to repeatedly stop and start tomcat
> whenever I get that exception.
>
> With the site load growing I am affraid that the
> server will crash every 5 minutes. Now I have to
> restart every other day.
>
> Thanks in advance.
>
> Lumi
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/