compiler
compiler

Reputation: 4363

How to quit strace when attached to a process?

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

Anyone knows?

Upvotes: 15

Views: 20439

Answers (3)

Carl Bellingan
Carl Bellingan

Reputation: 1480

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

Upvotes: 16

goose_wh
goose_wh

Reputation: 77

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

Upvotes: 7

Neva
Neva

Reputation: 1330

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

Upvotes: 2

Related Questions