Re: Socket CLOSE_WAIT state for a long time (days)

From: Martijn van Oosterhout
Date: Thu Apr 14 2005 - 20:24:22 EST


On Thu, Apr 14, 2005 at 04:05:18PM -0300, lucianolnx wrote:
Content-Description: Mail message body
> 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.

At a guess, a program is neglecting to close the filescriptors. Use
lsof to find out if someone still has an open socket somewhere. I
actually ran into something similar when a process forked a child with
the FD but didn't know about it. The parent had closed it but the child
still contained a reference.

Hope this helps,
--
Martijn van Oosterhout <kleptog@xxxxxxxxx> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment: pgp00000.pgp
Description: PGP signature