Well folks, this one has been puzzling me for weeks. I have read RFCs and many documents, but it appears that no one can give me a definate.

Background

Trying to determine the level of close-wait states on an Internet0based application. Netstat -na is very good for getting the basic info. Now I can monitor the states with a script. However, while I cannot terminate the sockets, I can restart the application, causing all sockets to resolve themselves. However, before I start monkeyong around with this, I need to get definitive answers as the the cause of close-wait states and instead of writing a script to restart an application after a number of close-wait state appear, perhaps a script to prevent them would be better?

Below is a simple diagram taken from the RFC on TCP based connections:


TCP A TCP B
1. ESTABLISHED ESTABLISHED
2. (Close) FIN-WAIT-1 --> <SEQ=100><ACK=300><CTL=FIN,ACK> --> CLOSE-WAIT
3. FIN-WAIT-2 <-- <SEQ=300><ACK=101><CTL=ACK> <-- CLOSE-WAIT
4. (Close) TIME-WAIT <-- <SEQ=300><ACK=101><CTL=FIN,ACK> <-- LAST-ACK
5. TIME-WAIT --> <SEQ=101><ACK=301><CTL=ACK> --> CLOSED
6. (2 MSL) CLOSED

Can anyone provide me with a few guidlines on which way to go? Or, has something already been created to do the job.

By the way, I also tried tunning the tcp values of the OS which has made little to no difference.


In reply to Smartly dealing with CLOSE-WAIT states by sdyates

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.