Re: DTrace: Sending ^C while running script produces no output
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?.. For example, while trying out a one-liner (from http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): bran...@d820:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 514 probes ^C BTW, sudo might play a role here... Just a thought. bran...@d820:~$ (12-02 23:11) If I instead, from another terminal, use pkill to quit or terminate the process, I get output: bran...@d820:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }'; dtrace: description 'syscall:::entry ' matched 514 probes akonadi_control 4 akonadiserver 5 syslogd 6 sendmail 8 akonadi_ical_resour 12 akonadi_maildir_res 12 akonadi_nepomuk_con 12 akonadi_vcard_resou 12 kuiserver12 akonadi_maildispatc 14 korgac 14 virtuoso-t 15 dbus-daemon 17 mysqld 18 hald 24 knotify4 27 akonadi_contacts_re 36 nepomukservicestub 70 pkill70 powerd 72 dtrace 101 zsh 111 sudo495 kwin 2812 firefox-bin3175 kdeinit4 11044 Xorg 39588 bran...@d820:~$ (12-02 23:14) I also want to add that I've tried this with a variety of shells on both 8.2-PRERELEASE and HEAD systems, i386 and amd64, built with GCC and nearly GENERIC kernels in order to try to eliminate the cause. I feel as though this has something to do with file descriptors being closed too soon when handling the signal or something of that nature. It's also been suggested that this could be a bug in libdtrace, but I haven't the knowledge (or skill) to try and pinpoint the cause myself. Is there anyone here that may be able to provide feedback or debugging suggestions? Thanks! -Brandon [1] This isn't always the case, only like 99.99% of the time. Sometimes I do get output, but usually it's just snippets, and sometimes random characters! -- Andriy Gapon ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: DTrace: Sending ^C while running script produces no output
On Sat, Dec 4, 2010 at 2:32 PM, Andriy Gapon a...@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. For example, while trying out a one-liner (from http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): bran...@d820:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 514 probes ^C BTW, sudo might play a role here... Just 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... -Brandon ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: DTrace: Sending ^C while running script produces no output
On Sat, Dec 4, 2010 at 3:27 PM, Brandon Gooch jamesbrandongo...@gmail.com wrote: On Sat, Dec 4, 2010 at 2:32 PM, Andriy Gapon a...@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): bran...@d820:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 514 probes ^C BTW, sudo might play a role here... Just 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=0x80065d0d0 mask=0x0 code=0x0 8804 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffe06c,0) 8804 initial thread RET sigprocmask 0 8804 initial thread CALL sigreturn(0x7fffdc90) 8804 initial thread RET sigreturn JUSTRETURN 8804 initial thread CALL fstat(0x1,0x7fffe000) 8804 initial thread STRU struct stat {dev=67174144, ino=120, mode=crw--w , nlink=1, uid=1001, gid=4, rdev=120, atime=1291504111, stime=1291504111, ctime= 1291504111, birthtime=-1, size=0, blksize=4096, blocks=0, flags=0x0 } 8804 initial thread RET fstat 0 8804 initial thread CALL ioctl(0x1,TIOCGETA,0x7fffe050) 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=0x80065d0d0 mask=0x0 code=0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread PSIG SIGINT caught handler=0x80065d0d0 mask=0x0 code=0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread PSIG SIGINT caught handler=0x80065d0d0 mask=0x0 code=0x0 4527 initial thread CALL sigprocmask(SIG_SETMASK,0x7fffe22c,0) 4527 initial thread RET sigprocmask 0 4527 initial thread CALL sigreturn(0x7fffde50) 4527 initial thread RET sigreturn JUSTRETURN 4527 initial thread CALL fstat(0x1,0x7fffe1c0) 4527 initial thread STRU struct stat {dev=67174144, ino=128, mode=crw--w , nlink=1, uid=1001, gid=4, rdev=128, atime=1291523109, stime=1291523110, ctime= 1291523110, birthtime=-1, size=0, blksize=4096, blocks=0, flags=0x0 } 4527 initial thread RET fstat 0 4527 initial thread CALL ioctl(0x1,TIOCGETA,0x7fffe210) 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 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: DTrace: Sending ^C while running script produces no output
On Thu, Dec 2, 2010 at 11:48 PM, Artem Belevich fbsdl...@src.cx wrote: On Thu, Dec 2, 2010 at 9:46 PM, Artem Belevich fbsdl...@src.cx wrote: On Thu, Dec 2, 2010 at 9:20 PM, Brandon Gooch jamesbrandongo...@gmail.com wrote: 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]. For example, while trying out a one-liner (from http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): I've got two boxes, both running stable-8/amd64. stable/8 r215749 (+cyclic patch) - reliably produces output, though for some reason does not count anything for 32-bit apps. stable/8 r215546 - seems to have the problem you've described. I did get normal output once out of 10 or so attempts. Tried on another box, also amd64: stable/8 r212650 - works fine. I've rebuilt kernel and world on every DTrace enabled system. I built from a clean svn checkout. I still see this behavior, although it's definitely the worst on HEAD: bran...@x300:/usr/src$ svn info (12-03 22:00) Path: . URL: svn://svn.freebsd.org/base/head Repository Root: svn://svn.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 216114 Node Kind: directory Schedule: normal Last Changed Author: lstewart Last Changed Rev: 216114 Last Changed Date: 2010-12-02 00:05:44 -0600 (Thu, 02 Dec 2010) The following NEVER works on this system running HEAD: bran...@x300:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 514 probes ^C bran...@x300:~$ (12-03 21:59) Of course, sending ANY signal to dtrace via pkill or killall promptly causes dtrace to spit out: bran...@x300:~$ sudo dtrace -n 'syscall:::entry { @num[execname] = count(); }' dtrace: description 'syscall:::entry ' matched 514 probes dbus-daemon 6 syslogd 7 ntpd 8 sendmail 9 hald-addon-storage 10 cut 39 hald 40 mixer44 killall 51 powerd 55 zsh 69 openbox 90 dtrace 109 xterm 172 conky 180 sh 231 sudo457 wpa_supplicant 648 Xorg 1557 firefox-bin1992 bran...@x300:~$ (12-03 22:02) Very troubling. Question: Should I be rebuilding my ports (xterm, zsh, ksh, etc...) after updating to make sure that the proper things are happening when sending these keyboard interrupts? I'm really grasping here :/ -Brandon ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: DTrace: Sending ^C while running script produces no output
On Thu, Dec 2, 2010 at 9:20 PM, Brandon Gooch jamesbrandongo...@gmail.com wrote: 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]. For example, while trying out a one-liner (from http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): I've got two boxes, both running stable-8/amd64. stable/8 r215749 (+cyclic patch) - reliably produces output, though for some reason does not count anything for 32-bit apps. stable/8 r215546 - seems to have the problem you've described. I did get normal output once out of 10 or so attempts. Given that a recent version seems to be working, it may be worth it to update FreeBSD and try again. --Artem ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: DTrace: Sending ^C while running script produces no output
On Thu, Dec 2, 2010 at 9:46 PM, Artem Belevich fbsdl...@src.cx wrote: On Thu, Dec 2, 2010 at 9:20 PM, Brandon Gooch jamesbrandongo...@gmail.com wrote: 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]. For example, while trying out a one-liner (from http://www.brendangregg.com/DTrace/dtrace_oneliners.txt): I've got two boxes, both running stable-8/amd64. stable/8 r215749 (+cyclic patch) - reliably produces output, though for some reason does not count anything for 32-bit apps. stable/8 r215546 - seems to have the problem you've described. I did get normal output once out of 10 or so attempts. Tried on another box, also amd64: stable/8 r212650 - works fine. --Artem ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org