Sockets are perenially in CLOSE_WAIT

TCP/IP sockets in CLOSE_WAIT state on a Web server …[IBM]

TCP Connection States and Netstat Output[Microsoft]

Tomcat bug database: Bug 28727
We use Tomcat 5.018/5.0.19 in a mission critical application. Every second or
third try specific connections fail. Tomcat then seems to be unable to close
the connections, although the client already has terminated its session (and
shutdown his computer). Within Tomcat the connections are left
as “CLOSE_WAIT”. (=> netstat -a)

As soon as one connection shows up as “CLOSE_WAIT”, the connection-thread
begins to loop (seems as if select is no more blocking) and starts to eat up
cpu power. When two or three threads are in the state “CLOSE_WAIT”, Tomcat
performance slows down until the non-blocking “CLOSE_WAIT”-threads are
consuming everything.

We have to shutdown Tomcat then.

What is happening here? Is there a workaround available? What about the CLOSE-
WAIT-connections (they are all issued via mobile clients via GPRS)

We tried both Tomcat 5.0.19 and 5.0.18. Same situation.

Windows 2000/XP, Service Packs applied; Apache 2.0.47, Mode_JK2, JDK1.4.2_03
and JDK 1.4.2_04 (tried both, both SUN)