How to quit strace when attached to a process?

compiler picture compiler · Mar 25, 2011 · Viewed 14.3k times · Source
[root@woyo test]# strace -o /tmp/lsof.strace -p 5625
Process 5625 attached - interrupt to quit
q

Anyone knows?

Answer

Carl Bellingan picture Carl Bellingan · Jan 15, 2014

This seems to occur when a process is blocked waiting for a pid that no longer exists.

If your strace doesn't respond to Ctrl + C, than as mentioned, use Ctrl + Z and bg to push it to the background then attach to the running strace process with another strace. This should tell you why the first strace is blocked.

# strace -p 32035
Process 32035 attached - interrupt to quit
^Z
# bg
[1]+ strace -p 32035 &
# ps uax|grep strace
root      1886  0.0  0.0 103452   840 pts/2    S+   05:59   0:00 grep strace
root     30114  0.0  0.0   4452   572 pts/2    S    05:59   0:00 strace -p 32035
# strace -p 30114
Process 30114 attached - interrupt to quit
wait4(-1, 

You can then kill off these processes with a kill -9