Skip to content

Instantly share code, notes, and snippets.

@D4R4
Created October 25, 2021 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save D4R4/4dcc5355920a2933f85df9dbac1a22e5 to your computer and use it in GitHub Desktop.
Save D4R4/4dcc5355920a2933f85df9dbac1a22e5 to your computer and use it in GitHub Desktop.
Recover process with stuck fd call, from superuser.blog
# Find process information
ps aux | grep <name>
strace -p <pid>
ls -l /proc//fd
lrwx-- 1 sanket sanket 64 Feb 5 23:00 0 ->; /dev/pts/19
lrwx-- 1 sanket sanket 64 Feb 5 23:00 1 ->; /dev/pts/19
lrwx-- 1 sanket sanket 64 Feb 5 22:59 2 ->; /dev/pts/19
...
lrwx-- 1 sanket sanket 64 Feb 5 23:00 11 -> socket:[102286]
$ lsof -i -a -p <pid> | grep 102286
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
telnet 14480 sanket 3u IPv4 102286 0t0 TCP 192.168.1.2:59254 ->; maa03s21-in-f78.1e100.net:http (ESTABLISHED)
$ gdb -p <pid>
call close(11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment