简体   繁体   English

lsof的CLOSE_WAIT数

[英]Number of CLOSE_WAIT with lsof

I 一世

lsof | grep CLOSE_WAIT | wc -l

on ubuntu 14.04 LTS 在Ubuntu 14.04 LTS上

I got the PID and TID displayed. 我得到了显示的PID和TID。 There are say 70 CLOSE_WAITs on a java proc with x number of threads. 在一个具有x个线程的java proc上有70个CLOSE_WAIT。

However, if I do 但是,如果我这样做

lsof -i | grep CLOSE_WAIT |wc -l

I got only 1, which is the java process (no TID). 我只有1,这是Java进程(没有TID)。

Does it mean that we can't reliably figure out FS leak by doing lsof -i? 这是否意味着我们无法通过执行lsof -i来可靠地确定FS泄漏? We always have to use "lsof"? 我们总是必须使用“ lsof”吗?

As a sidebar, does anyone know why ELB is not closing the connection? 作为补充,没有人知道为什么ELB没有关闭连接吗?

java 9645 9863 ubuntu 133u IPv4 19375 0t0 TCP ip-10-20-187-89:51548->ec2-100-200-86-25.compute-1.amazonaws.com:https (CLOSE_WAIT) java 9645 9864 ubuntu 133u IPv4 19375 0t0 TCP ip-10-20-187-89:51548->ec2-100-200-86-25.compute-1.amazonaws.com:https (CLOSE_WAIT) java 9645 9865 ubuntu 133u IPv4 19375 0t0 TCP ip-10-20-187-89:51548->ec2-100-200-25.compute-1.amazonaws.com:https (CLOSE_WAIT) java 9645 9902 ubuntu 133u IPv4 19375 0t0 TCP ip-10-20-187-89:51548->ec2-100-200-25.compute-1.amazonaws.com:https (CLOSE_WAIT)

Thanks, 谢谢,

I'd recommend consulting a diagram like this one . 我建议参考这样的图表 A TCP connection is not considered closed each side sends a FIN and gets an ACK. TCP连接不被认为是封闭的,每一端都发送FIN并获得ACK。

As stated here . 如此处所述 CLOSE_WAIT usually indicates the remote end has sent a FIN and been ACK'd by the local end, but the local end has not sent a FIN. CLOSE_WAIT通常指示远程端已发送FIN,并已被本地端确认,但本地端尚未发送FIN。

You're likely not seeing the rest of the CLOSE_WAIT entries with lsof -i because the remote address is not being shown. 您可能看不到lsof -i剩下的CLOSE_WAIT条目,因为未显示远程地址。 It likely shows as empty. 它可能显示为空。

See also: 也可以看看:

https://superuser.com/questions/173535/what-are-close-wait-and-time-wait-states https://superuser.com/questions/173535/what-are-close-wait-and-time-wait-states

https://serverfault.com/questions/450055/lot-of-fin-wait2-close-wait-last-ack-and-time-wait-in-haproxy https://serverfault.com/questions/450055/lot-of-fin-wait2-close-wait-last-ack-and-time-wait-in-haproxy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM