Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Aug 2011 00:41:38 +0800
From:      ambrosehuang ambrose <ambrosehua@gmail.com>
To:        Andriy Gapon <avg@freebsd.org>
Cc:        Yuri <yuri@rawbw.com>, Fabian Keil <freebsd-listen@fabiankeil.de>, freebsd-hackers@freebsd.org
Subject:   Re: DTrace script asserts and kills the other process
Message-ID:  <CAMwoQQ4S4-jWapNY4gb-%2B3E8mQ8%2B6tPrquVcQyoF6HKhqnQH=w@mail.gmail.com>
In-Reply-To: <CAMwoQQ5__MMm%2BL7w6_giXGdnjiLS=tF7p%2BZaALvtw6qXokDzpQ@mail.gmail.com>
References:  <20110722202811.17302hol2s3ar084@newwebmail.rawbw.com> <20110723135655.4479d190@fabiankeil.de> <CAMwoQQ6gNDDTi020ZDkrFQK6HbVBKeMATeZUqoGvaPO1q8o7Ug@mail.gmail.com> <4E392458.1060606@FreeBSD.org> <CAMwoQQ5__MMm%2BL7w6_giXGdnjiLS=tF7p%2BZaALvtw6qXokDzpQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/8/4 ambrosehuang ambrose <ambrosehua@gmail.com>

>
>
> 2011/8/3 Andriy Gapon <avg@freebsd.org>
>
>>  on 28/07/2011 07:10 ambrosehuang ambrose said the following:
>> >> Yuri <yuri@rawbw.com> wrote:
>> >>
>> >>> I am trying to run this dtrace script:
>> >>>
>> >>> #!/usr/sbin/dtrace -s
>> >>> pid123:libc::entry
>> >>> {
>> >>> self->timestmp[probefunc] = timestmp;
>> >>> }
>> >>> pid123:libc::return
>> >>> /self->timestmp[probefunc] != 0/
>> >>> {
>> >>> @function_duration[probefunc] = sum(timestmp -
>> >>> self->timestmp[probefunc]); timestmp[probefunc] = 0;
>> >>> }
>> >>>
>> >>> which I got from here:
>> >>> http://www.princeton.edu/~unix/Solaris/troubleshoot/dtrace.html
>> >>> replacing 123 with the pid of some running process.
>> >>>
>> >>> Result: dtrace utility asserts:
>> >>> Assertion failed: (dpr != NULL), file
>> >>>
>> >>
>> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c,
>> >>> line 751.
>> >>> Abort trap: 6
>> >>>
>> >>> Also the target process is killed too:
>> >>> Killed: 9
>> >>>
>> >>> 8.2-STABLE amd64
>> >>
>> >> This is a known issue. You may be able to work around it by
>> >> letting dtrace start the traced process.
>> >>
>> >> There's already a PR about it:
>> >> http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/158431
>> >> but the limitation isn't mentioned in the wiki:
>> >> http://wiki.freebsd.org/DTrace/userland
>>
>> FYI and benefit:  I've committed what should be a fix for this issue,
>> r224632.
>>
>> >> It's not clear to me if this has worked in the past or if it
>> >> works for other architectures (the reporter and I are both using
>> >> amd64, too).
>> >>
>> >> Fabian
>> >>
>> > I came across the same problem in 8.2-stable , it seemed the problem had
>> > been there since 8.2-release with userland dtrace integrated. I followed
>> the
>> > PR185431 and found when  dtrace  started, it indeed attached to the
>> traced
>> > process( dpr != NULL), but the traced process died soon, and
>> > according to the PR, this is "error in error" since the dtrace  came
>> accross
>> > error in dfatal
>> >
>> ....................................................................................................................................................
>> > #3 0x0000000808d8af2d in dt_proc_lookup (dtp=0x80b841000, P=0x80d7ffb40,
>> > remove=0)
>> > at
>> >
>> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c:751
>> > #4 0x0000000808d8af92 in dt_proc_destroy (dtp=0x80b841000,
>> P=0x80d7ffb40)
>> > at
>> >
>> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c:763
>> > #5 0x0000000808d8bc6e in dt_proc_hash_destroy (dtp=0x80b841000)
>> > at
>> >
>> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c:1162
>> > #6 0x0000000808daa4b5 in dtrace_close (dtp=0x80b841000)
>> > at
>> >
>> /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c:1554
>> > #7 0x0000000000402775 in dfatal (fmt=0x408572 "no probes %s\n")
>> > at
>> >
>> /usr/src/cddl/usr.sbin/dtrace/../../../cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:236
>> > #8 0x0000000000406b2c in main (argc=3, argv=0x7ffffffed9c0)
>> > at
>> >
>> /usr/src/cddl/usr.sbin/dtrace/../../../cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:1825
>> >
>> .....................................................................................................................................................
>> > _______________________________________________
>> > freebsd-hackers@freebsd.org mailing list
>> > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
>> > To unsubscribe, send any mail to "
>> freebsd-hackers-unsubscribe@freebsd.org"
>> >
>>
>> I just saw  your  commit, I will verify it on 8-stable soon, thank you!
>>
> --
>> Andriy Gapon
>>
> I test your commit on  8-stable, here is my commit:
commit 84f49c7ffa130ec4bcd7fb0a619b36ab615dfeb4
Author: mm <mm@FreeBSD.org>
Date:   Thu Aug 4 10:37:12 2011 +0000

this is the my result:

[root@lateaxfreebsd dtrace]# dtrace -n 'pid$target:libc::entry' -p 39699
libc.so.7: invalid probe specifier pid$target:libc::entry: probe description
pid39699:libc::entry
User defined signal 1: 30
[1]+  Hangup: 1               ../test

I also test the example from userland/dtrace in wiki, it failed with same
result,
 it seems the pid provider has something wrong with libc when probing;

[root@lateaxfreebsd dtrace]# dtrace -n 'pid$target:::entry' -p 40346
test: description 'pid$target:::entry' matched 2 probes
^C
success

[root@lateaxfreebsd dtrace]# dtrace -ln 'pid$target:::entry' -p 40346
   ID   PROVIDER            MODULE                          FUNCTION NAME
33913   pid40346              test                            _start entry
33914   pid40346              test                              main entry
User defined signal 1: 30
[1]+  Hangup: 1               ../test

Anyway, there is no core dump.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMwoQQ4S4-jWapNY4gb-%2B3E8mQ8%2B6tPrquVcQyoF6HKhqnQH=w>