Brendan Gregg - Sun Microsystems
2008-Jun-11 20:22 UTC
[dtrace-discuss] DTrace double probe firing on MacOS X with -dead_strip
G''Day, This issue was news to me, and may be useful for readers of this list. In brief: USDT providers on MacOS X that are built with the -dead_strip linker option have their probes fired twice by mistake. The workaround is not to use the -dead_strip option. Some more details: After integration of the JavaScript DTrace provider into Firefox, the Mozilla developers discovered that probes were firing twice by mistake - so results such as @[probename]=count() were doubled. The most likely reason was that probe placement had become incorrect - during provider development the Firefox code was changing, and I had to tweak the probe locations a few times. It sounded like more of the same, but I couldn''t see why this was happening in the code. The Mozilla developers discovered it happened with the -dead_strip linker option!: https://bugzilla.mozilla.org/show_bug.cgi?id=403132 which from a quick search looks like it is a known issue: http://www.opensource.apple.com/darwinsource/10.5/ld64-77/unit-tests/test-cases/dtrace-static-probes/Makefile as -dead_strip is part of the Apple sanity checks. That''s all I know. If you know more details, please reply. :-) I also don''t know if this was fixed in the recent release of MacOS X (if it is even considered a bug?). cheers, Brendan -- Brendan [CA, USA]
James McIlree
2008-Jun-15 20:33 UTC
[dtrace-discuss] DTrace double probe firing on MacOS X with -dead_strip
On Jun 11, 2008, at 1:22 PM, Brendan Gregg - Sun Microsystems wrote:> G''Day, > > This issue was news to me, and may be useful for readers of this list. > > In brief: > > USDT providers on MacOS X that are built with the -dead_strip linker > option > have their probes fired twice by mistake. The workaround is not to > use > the -dead_strip option. > > Some more details: > > After integration of the JavaScript DTrace provider into Firefox, the > Mozilla developers discovered that probes were firing twice by > mistake - > so results such as @[probename]=count() were doubled. > > The most likely reason was that probe placement had become incorrect - > during provider development the Firefox code was changing, and I had > to > tweak the probe locations a few times. It sounded like more of the > same, > but I couldn''t see why this was happening in the code. > > The Mozilla developers discovered it happened with the -dead_strip > linker > option!: > > https://bugzilla.mozilla.org/show_bug.cgi?id=403132 > > which from a quick search looks like it is a known issue: > > http://www.opensource.apple.com/darwinsource/10.5/ld64-77/unit-tests/test-cases/dtrace-static-probes/Makefile > > as -dead_strip is part of the Apple sanity checks. > > That''s all I know. If you know more details, please reply. :-) I > also > don''t know if this was fixed in the recent release of MacOS X (if it > is > even considered a bug?).Brendan, This is <rdar://problem/5628149>. OS X 10.5.3 does not have the fix, but if you download the free iPhone SDK, it has a patched linker which fixes this issue. James M