I am trying to debug a process that hangs, the output of strace for the process id has last line :
recvfrom(9, <detached ...><\/code> From this what I understand that the process is waiting on the socket.
How can I discover more about this ? does the file descriptor 9 will give me more information ? How can I use this file discover to know more about what it is waiting for ?
Since you are using strace<\/code> I assume you are on Linux and you know the process id.
In that case you can find a lot of info in
\/proc<\/code> .
Here is an example of what to do.
There will be an entry corresponding to the fd you are interested in and that fd should be a socket as such:
$ ls -l /proc/3311/fd
total 0
lrwx------ 1 alanau alanau 64 Sep 24 20:37 0 -> /dev/pts/0
lrwx------ 1 alanau alanau 64 Sep 24 20:37 1 -> /dev/pts/0
lrwx------ 1 alanau alanau 64 Sep 24 20:37 2 -> /dev/pts/0
lrwx------ 1 alanau alanau 64 Sep 24 20:37 3 -> socket:[23182]
在strace<\/code>输出中查看文件描述符何时从
open()<\/code> (或者可能是
socket()<\/code> )返回时,您将看到调用中使用的其他参数。
"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.