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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 21, 2001 1:05 PM
> To: [EMAIL PROTECTED]
> 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/

Reply via email to