Find CLOSE_WAIT leaks
Find sockets that the app forgot to close; a growing CLOSE_WAIT count means an fd or connection leak
lsof -nP -i -sTCP:CLOSE_WAIT
- tool
- lsof19 commands
More lsof commands
-
lsof -nP -i @<host>:<port>Show only sockets that talk to a specific host and port
-
lsof -p <pid> -a -d txt,memShow only the executable and the loaded shared libraries; -a joins the filters with AND, useful after a deploy
-
lsof -nP -p <pid> | wc -lQuick fd count to compare with ulimit -n and spot leaks; even faster: ls /proc/<pid>/fd | wc -l
-
lsof -p $(pgrep nginx) | head -30Show all files that nginx has open: regular files, sockets and pipes
-
lsof -i :8080Find which process uses port 8080