Ending strace sends SIGSTOP to traced process
Yong Huang
yong321 at yahoo.com
Fri Oct 23 21:35:55 UTC 2009
My strace on this box will stop the traced process.
$ strace -V
strace -- version 4.5.18
$ uname -a
Linux <my hostname> 2.6.18-92.1.22.el5 #1 SMP Fri Dec 5 09:28:22 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
$ sleep 100 &
[1] 20379
$ grep ^State /proc/20379/status
State: S (sleeping)
$ strace -p 20379
Process 20379 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...> <unfinished ...>
Process 20379 detached
[1]+ Stopped sleep 100
$ grep ^State /proc/20379/status
State: T (stopped)
$ kill -CONT 20379
$ grep ^State /proc/20379/status
State: S (sleeping)
You can see that after I press Control-C to quit strace, it reports the sleep process is stopped, verified with /proc/<pid>/status. It can be un-stopped by kill -CONT.
Is this behavior considered a bug? How can I make strace not stop the traced process?
I find another box running the same Red Hat, same strace, slightly different kernel version (2.6.18-128.1.10.el5). The behavior is slightly different: Control-C can't quit strace. I have to kill strace. Once strace is killed, the sleep remains in sleeping state. (Of course, the problem box also won't have the problem if strace is killed instead of quit by Control-C.)
Yong Huang
More information about the Strace-devel
mailing list