Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In many TCPIP and Web tunning guide, recommends increasing max number of file descriptors when getting the error "Too many open files"

but, i can't see TIME_WAIT in outputs of "lsof -i"

Does anyone know that TIME_WAIT consumes file descriptors? or not

share|improve this question

1 Answer 1

TIME_WAIT is a TCP state and doesn't consume file descriptors persay. However the sockets in TIME_WAIT will consume file descriptors. A socket is a file like just about everything else in unix. If this is Linux you can tune the expire time of sockets (how long they are in time wait) as well as enable socket recycling in /proc/sys/net/ipv4/.

Two items of particular interest are probably:

sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_tw_reuse=1

As always, test these beforehand if you can.

share|improve this answer
    
is it possible to restore a "TIME_WAIT" connection to "ESTABLISHED" again? –  jyz May 31 '11 at 16:01
    
AFAIK, the side of the connection that did a close() on the socket goes into TIME_WAIT on that socket to ensure that the the other side receives the close()/FIN. If the peer doesn't see the FIN, the side calling close() should retransmit it. So my understanding is that the answer is "it shouldn't be possible, no." –  James Cape May 7 '12 at 15:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.