Date: Sat, 4 Dec 2010 23:00:09 -0600 From: Brandon Gooch <jamesbrandongooch@gmail.com> To: Andriy Gapon <avg@freebsd.org> Cc: freebsd-hackers@freebsd.org, Artem Belevich <fbsdlist@src.cx> Subject: Re: DTrace: Sending ^C while running script produces no output Message-ID: <AANLkTik5mRAG3=r98fQt0Y8jokvYY99yfoob0U1U6LjE@mail.gmail.com> In-Reply-To: <AANLkTimJJjF2vGQZmyYUOg6r41q2q7nw59dSTOB0M5iv@mail.gmail.com> References: <AANLkTikmxpRQY_nOD6SB32-nd7YTTgysv2zWgzv7ozYy@mail.gmail.com> <4CFAA579.1010701@freebsd.org> <AANLkTimJJjF2vGQZmyYUOg6r41q2q7nw59dSTOB0M5iv@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 4, 2010 at 3:27 PM, Brandon Gooch <jamesbrandongooch@gmail.com> wrote: > On Sat, Dec 4, 2010 at 2:32 PM, Andriy Gapon <avg@freebsd.org> wrote: >> on 03/12/2010 07:20 Brandon Gooch said the following: >>> I've been tinkering with DTrace a bit, and I've notice something >>> peculiar on each system I've tried it on. >>> >>> Sending ^C from the keyboard in the terminal (console, XTerm, Konsole) >>> produces no output [1]. >> >> Can you ktrace the dtrace process? >> I wonder, could it be that SIGINT from ^C is somehow delivered twice?.. > > I'll give it a shot in just a bit. I think you are correct, see below. > >>> For example, while trying out a one-liner (from >>> http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): >>> >>> brandon@d820:~$ sudo dtrace -n 'syscall:::entry { @num[execname] =3D co= unt(); }' >>> dtrace: description 'syscall:::entry ' matched 514 probes >>> ^C >> >> BTW, sudo might play a role here... =A0Just a thought. > > I could see that for sure. I can't believe I hadn't thought of that > right off the bat, but then again I tested while logged in as root > from the console -- I think :/ > > Human memory is unreliable y'know... You were absolutely on to it -- sudo appears to be the culprit here. I ktrace'd both an attempt using sudo and not using sudo (as root). Snippet of ktrace output when running the aforementioned dtrace command as root, which works as expected: 8804 initial thread PSIG SIGINT caught handler=3D0x80065d0d0 mask=3D0x0 = code=3D0x0 8804 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffffffe06c,0) 8804 initial thread RET sigprocmask 0 8804 initial thread CALL sigreturn(0x7fffffffdc90) 8804 initial thread RET sigreturn JUSTRETURN 8804 initial thread CALL fstat(0x1,0x7fffffffe000) 8804 initial thread STRU struct stat {dev=3D67174144, ino=3D120, mode=3D= crw--w---- , nlink=3D1, uid=3D1001, gid=3D4, rdev=3D120, atime=3D1291504111, stime=3D1= 291504111, ctime=3D 1291504111, birthtime=3D-1, size=3D0, blksize=3D4096, blocks=3D0, flags=3D0= x0 } 8804 initial thread RET fstat 0 8804 initial thread CALL ioctl(0x1,TIOCGETA,0x7fffffffe050) 8804 initial thread RET ioctl 0 8804 initial thread CALL write(0x1,0x8029b6000,0x1) 8804 initial thread GIO fd 1 wrote 1 byte " Snippet of ktrace output when running the aforementioned dtrace command with sudo, which produces no output: 4527 initial thread PSIG SIGINT caught handler=3D0x80065d0d0 mask=3D0x0 = code=3D0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffffffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffffffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread PSIG SIGINT caught handler=3D0x80065d0d0 mask=3D0x0 = code=3D0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffffffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffffffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread PSIG SIGINT caught handler=3D0x80065d0d0 mask=3D0x0 = code=3D0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffffffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffffffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread CALL fstat(0x1,0x7fffffffe1c0) 4527 initial thread STRU struct stat {dev=3D67174144, ino=3D128, mode=3D= crw--w---- , nlink=3D1, uid=3D1001, gid=3D4, rdev=3D128, atime=3D1291523109, stime=3D1= 291523110, ctime=3D 1291523110, birthtime=3D-1, size=3D0, blksize=3D4096, blocks=3D0, flags=3D0= x0 } 4527 initial thread RET fstat 0 4527 initial thread CALL ioctl(0x1,TIOCGETA,0x7fffffffe210) 4527 initial thread RET ioctl 0 4527 initial thread CALL write(0x1,0x8029b6000,0x1) 4527 initial thread GIO fd 1 wrote 1 byte Well, I'm glad to finally get to the bottom of this, and I want to apologize for the noise, but I think this is still a "gotcha" for new DTrace users, and I hope it can be noted somewhere (perhaps the DTrace sections on the FreeBSD wiki). -Brandon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTik5mRAG3=r98fQt0Y8jokvYY99yfoob0U1U6LjE>