Socket CLOSE_WAIT state for a long time (days)

From: lucianolnx
Date: Thu Apr 14 2005 - 14:09:40 EST


Do someone could explain someting about socket that keeps its CLOSE_WAIT
state for a long time (like as 5 days or more) ?

DETAILS ABOUT THE PROGRAM:
We have a process (deamon) that keeps running all the time, and sometimes
uses a connection with a DBMS (Oracle database) to store some data in the
database. But, this DBMS is configured to close idle connetions after 30
minutes.

On the next time that the deamon try to use de DBMS connection, this
conneciton obviously is closed/invalid, and then it use a ODBC API to
re-open the connection, and so on.

After about 2 days we have noted that was around 70 connections on
CLOSE_WAIT state, like following (from "netstat -ano"):
...
TCP 10.10.10.228:1039 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1043 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1044 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1045 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1047 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1048 10.10.20.103:1521 CLOSE_WAIT 3412
TCP 10.10.10.228:1058 10.10.20.103:1521 CLOSE_WAIT 3412
...
So, we monitored the next event that would re-open DBMS connection, and then
we monitored the close idle connection event from DBMS. Obvisourly, more 1
connection on CLOSE_WAIT state appeared.

Stopping the process all connecions on CLOSE_WAIT state was released.

Some ideas ?
Whould be it a bug in the program ?

Luciano