DTrace segfaults on Leopard

W

Wincent Colaiuta

I'd like to use DTrace on Leopard to do some profiling of a Ruby app
but I'm finding that any script that uses the "object-free" probe
eventually leads to a segfault.

For example, the script that Apple provides at:

/Developer/Examples/Ruby/DTrace/print_memory_usage.d

To reproduce:

1. In one Terminal fire up an instance of irb so that dtrace can find
the probes

2. In another:

sudo dtrace -qs /Developer/Examples/Ruby/DTrace/print_memory_usage.d

3. In another, run any sizeable Ruby script and watch the crashes
ensue.

For example:

# won't crash
ruby -e '1000.times{1+2}'

# will crash
ruby -e '10000.times{1+2}'

# will crash
irb

Here's the console output for the irb crash:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/irb/extend-command.rb:93: [BUG] Segmentation fault
ruby 1.8.6 (2007-06-07) [universal-darwin9.0]

Abort trap

And here's the stack trace:

Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000007262694c
Crashed Thread: 0

Thread 0 Crashed:
0 libSystem.B.dylib 0x92d7f47a __kill + 10
1 libSystem.B.dylib 0x92df6782 raise + 26
2 libSystem.B.dylib 0x92e05d3f abort + 73
3 libruby.1.dylib 0x000cdcbc rb_exc_new + 0
4 libruby.1.dylib 0x001346f3 rb_gc_mark_trap_list +
508
5 libSystem.B.dylib 0x92d7d97b _sigtramp + 43
6 ??? 0xffffffff 0 + 4294967295
7 libruby.1.dylib 0x00144c08 rb_mod_class_variables +
634
8 libruby.1.dylib 0x00145680 rb_class_path + 31
9 libruby.1.dylib 0x001458a8 rb_obj_classname + 91
10 libruby.1.dylib 0x000eddbb rb_gc_mark_maybe + 1394
11 libruby.1.dylib 0x000ee493 rb_newobj + 28
12 libruby.1.dylib 0x0010af8f rb_node_newnode + 28
13 libruby.1.dylib 0x0011c881 ruby_yyparse + 53250
14 libruby.1.dylib 0x0011dda2 ruby_yyparse + 58659
15 libruby.1.dylib 0x00134271 ruby_process_options +
1148
16 libruby.1.dylib 0x000e69dd rb_load + 847
17 libruby.1.dylib 0x000e70a8 rb_require_safe + 1117
18 libruby.1.dylib 0x000da636 rb_eval_string_wrap +
17759
19 libruby.1.dylib 0x000db24a rb_eval_string_wrap +
20851
20 libruby.1.dylib 0x000d84c5 rb_eval_string_wrap +
9198
21 libruby.1.dylib 0x000e6a47 rb_load + 953
22 libruby.1.dylib 0x000e70a8 rb_require_safe + 1117
23 libruby.1.dylib 0x000da636 rb_eval_string_wrap +
17759
24 libruby.1.dylib 0x000db24a rb_eval_string_wrap +
20851
25 libruby.1.dylib 0x000d84c5 rb_eval_string_wrap +
9198
26 libruby.1.dylib 0x000e7388 rb_load_protect + 298
27 libruby.1.dylib 0x000e73b9 ruby_exec + 22
28 libruby.1.dylib 0x000e73e5 ruby_run + 42
29 ruby 0x00001fff 0x1000 + 4095
30 ruby 0x00001fa6 start + 54

Needless to say, I can't run the application that I'd like to profile
either. The same crashes occur when trying to use the "object-free"
probe from inside Apple's Instruments GUI.

Can anybody else repro this or is there something fishy with my
system?

Cheers,
Wincent
 
D

Dane Jensen

I'd like to use DTrace on Leopard to do some profiling of a Ruby app
but I'm finding that any script that uses the "object-free" probe
eventually leads to a segfault.
[snip]

Needless to say, I can't run the application that I'd like to profile
either. The same crashes occur when trying to use the "object-free"
probe from inside Apple's Instruments GUI.

Can anybody else repro this or is there something fishy with my
system?

Cheers,
Wincent

I can reproduce it every time. Happens without fail.

Kind of makes it useless for watching object creation and deletion,
huh? :)

Have you had any luck getting it to work?

-Dane
 
J

Juan Matías

I have just read this article, maybe could help you.
Apple Crippled Its DTrace Port:
http://developers.slashdot.org/article.pl?sid=3D08/01/22/2156244

Juan Mat=EDas Repetti.

I'd like to use DTrace on Leopard to do some profiling of a Ruby app
but I'm finding that any script that uses the "object-free" probe
eventually leads to a segfault.
[snip]

Needless to say, I can't run the application that I'd like to profile
either. The same crashes occur when trying to use the "object-free"
probe from inside Apple's Instruments GUI.

Can anybody else repro this or is there something fishy with my
system?

Cheers,
Wincent

I can reproduce it every time. Happens without fail.

Kind of makes it useless for watching object creation and deletion,
huh? :)

Have you had any luck getting it to work?

-Dane


--=20
=ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB
 
S

Scott Barron

I have just read this article, maybe could help you.
Apple Crippled Its DTrace Port:
http://developers.slashdot.org/article.pl?sid=3D08/01/22/2156244

Juan Mat=EDas Repetti.

I'd like to use DTrace on Leopard to do some profiling of a Ruby app
but I'm finding that any script that uses the "object-free" probe
eventually leads to a segfault.
[snip]

Needless to say, I can't run the application that I'd like to profile
either. The same crashes occur when trying to use the "object-free"
probe from inside Apple's Instruments GUI.

Can anybody else repro this or is there something fishy with my
system?

Cheers,
Wincent

I can reproduce it every time. Happens without fail.

Kind of makes it useless for watching object creation and deletion,
huh? :)

Have you had any luck getting it to work?

-Dane

Apple's modifications to DTrace aren't the issue here - it's a bug in the
Ruby patch, which would be my fault. I can reproduce it and I'm looking
into a fix. I can release a new ruby patch with the fix but I'll have to
defer to the Apple guys to see how they want to handle OSX's ruby.

-Scott
 
T

Tim Becker

As far as I recall, I never got dtrace to work with irb at all. I'll
check when I get a chance. Anyone else have problems with irb?
-tim
 
L

Laurent Sansonetti

Apple's modifications to DTrace aren't the issue here - it's a bug in the
Ruby patch, which would be my fault. I can reproduce it and I'm looking
into a fix. I can release a new ruby patch with the fix but I'll have to
defer to the Apple guys to see how they want to handle OSX's ruby.

Yeah it seems to be a problem with the interpreter patch. I thought
that these crashes were ppc-only but apparently they also reproduce on
i386.

If you can fix it please let me know and I will do the necessary
procedure to also update Leopard's ruby.

Laurent
 
E

Eric Kustarz

Apple's modifications to DTrace aren't the issue here - it's a bug in
the
Ruby patch, which would be my fault. I can reproduce it and I'm looking
into a fix. I can release a new ruby patch with the fix but I'll have
to
defer to the Apple guys to see how they want to handle OSX's ruby.

-Scott

Any update on this? I'm still seeing this on OSX 10.5.6...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top