13
[root@woyo test]# strace -o /tmp/lsof.strace -p 5625
Process 5625 attached - interrupt to quit
q

Anyone knows?

compiler
  • 4,143
  • 9
  • 36
  • 40

3 Answers3

14

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

Carl Bellingan
  • 1,460
  • 12
  • 7
7

I've got by with sending strace to a background process with Ctrl + Z, then killing the strace PID manually.

goose_wh
  • 77
  • 1
  • 3
  • 1
    +1 bcoz if `ctrl+c` is not killing it then this is how you should do it. You might have to use `kill -9 ` to kill it manually. – sactiw Oct 04 '13 at 17:27
  • Note that if you do this, there's [a bug you might run into](https://bugzilla.redhat.com/show_bug.cgi?id=582408) on older OS's. The fix is: `kill -s CONT ` – mlissner Jun 28 '18 at 17:21
2

Have you tried Ctrl + C ? That you give an "Interruption" signal to the command.

Neva
  • 1,330
  • 9
  • 11