linux - 哪个线程监听特定的 UDP 端口
问题描述
我跑了:
# lsof | grep 10900
及其输出:
MyExecutab 103497 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103498 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103499 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103500 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103501 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103502 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
MyExecutab 103497 103503 myuser 7u IPv4 985833 0t0 UDP my.example.com:10900
我试图找出哪个线程正在从 UDP 端口 10900 读取。
似乎有 7 个线程从该端口读取,是真的吗?
我觉得实际上只有一个线程正在读取,但 lsof 只是列出了所有子线程(在同一进程中)和父线程。
netstat -plun
显示只有父线程 (PID) 正在侦听该端口:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 10.7.168.173:10900 0.0.0.0:* 103497/MyExecutable
我也查了/proc/[pid]/fd
。因为只有103497是PID,其余都是TID,所以/proc/
只有103497,其余没有。
那么真的有办法找出哪个线程监听特定的 UDP 端口吗?
我在 CentOS 7(内核 3.10)上。
谢谢!
解决方案
运行strace -ffp <pid>
并查看哪些线程使用文件描述符 7。
推荐阅读
- angular - 如何以编程方式设置 dxo-lookup 的数据源
- c - 如何在 C 中使用动态分配的内存
- azure-devops - msbuild 中的 .cspkg 生成
- python - ValueError:输入数组的维度少于指定的轴
- css - 如何摆脱 woocommerce_cart 上的“购物车摘要”标题?
- shared-memory - 退出时删除共享内存
- proxy - Jetty AsyncProxyServlet 怎么没有将所有请求都标记为 asyncStarted?
- apache-kafka - Logstash Kafka - 错误:给出负长度 -62
- java - 无法加载包装器属性,属性文件包含来自 xml 的代码
- mysql - Azure MySQL:SSL 连接错误:无法获取证书