大网数据广告活动
服务器运维问答

Using ftrace to spy on files being created?

· 52CE 我爱测

We are in this scenario: https://stackoverflow.com/questions/7304826/how-to-debug-a-multithreaded-hung-process-in-linux When we try to look at a rogue process (which is consuming 100% CPU) then it's in this state: ls -l /proc/XXX…

问题原文

原帖链接 · Patrick Rynhart · CC BY-SA 4.0

We are in this scenario: https://stackoverflow.com/questions/7304826/how-to-debug-a-multithreaded-hung-process-in-linux

When we try to look at a rogue process (which is consuming 100% CPU) then it's in this state:

ls -l /proc/XXXX/fd 
lrwx------ 1 root root 64 Feb  1 16:08 9 -> /tmp/.ZendSem.sdiU42 (deleted)

We'd like to know what was in the file (that is now deleted) in an attempt to try and track down what is causing the issue. I think that ftrace might be able to do this (or maybe another tool), but I don't know how to go about doing this.

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

/tmp/.ZendSem.sdiU42 is a lock file that was intentionally deleted right after it was created. This is sufficient to prevent this lock from being taken out by other threads. It also has the nice property of going away once the process is gone. See the php sources, ext/opcache/zend_shared_alloc.c


You need to collect lot more context about what your application is doing, and how this interacts with the software stack and kernel.

Identify the PID in web server logs and see if you can identify anything, perhaps when the worker was forked.

Profile the execution. On Linux, run perf top and see where it the most time. Install debug symbols, for this program and the kernel, until you can make sense of the function names. Also, try ltrace if you want to something like strace but for user library calls.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-02-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。