[#28561] Ruby::DL vs Ruby::FFI — Aston <blackapache512-ticket@...>

Ruby.DL and FFI libraries are great for programmers like me who are not internet programmers, but are more interested in scientific and number processing etc.

11 messages 2010/03/08

[#28686] trunk (26947) build fail with msys/mingw/vista — Jon <jon.forums@...>

I get the following build failure when msysgit's "c:\git\cmd" dir is on PATH.

8 messages 2010/03/16

[#28687] [Bug #2973] rb_bug - Segmentation fault - error.c:213 — rudolf gavlas <redmine@...>

Bug #2973: rb_bug - Segmentation fault - error.c:213

10 messages 2010/03/16

[#28735] [Bug #2982] Ruby tries to link with both openssl and readline — Lucas Nussbaum <redmine@...>

Bug #2982: Ruby tries to link with both openssl and readline

16 messages 2010/03/18

[#28736] [Bug #2983] Ruby (GPLv2 only) tries to link to with readline (now GPLv3) — Lucas Nussbaum <redmine@...>

Bug #2983: Ruby (GPLv2 only) tries to link to with readline (now GPLv3)

10 messages 2010/03/18

[#28907] [Bug #3000] Open SSL Segfaults — Christian Höltje <redmine@...>

Bug #3000: Open SSL Segfaults

19 messages 2010/03/23

[#28924] [Bug #3005] Ruby core dump - [BUG] rb_sys_fail() - errno == 0 — Sebastian YEPES <redmine@...>

Bug #3005: Ruby core dump - [BUG] rb_sys_fail() - errno == 0

10 messages 2010/03/24

[#28954] [Feature #3010] slow require gems in ruby 1.9.1 — Miao Jiang <redmine@...>

Feature #3010: slow require gems in ruby 1.9.1

15 messages 2010/03/24

[#29179] [Bug #3071] Convert rubygems and rdoc to use psych — Aaron Patterson <redmine@...>

Bug #3071: Convert rubygems and rdoc to use psych

10 messages 2010/03/31

[ruby-core:28712] When a trace hook raises an exception, should it terminate the program?

From: Rocky Bernstein <rockyb@...>
Date: 2010-03-17 11:42:18 UTC
List: ruby-core #28712
In Ruby 1.8 and the Ruby 1.9 trunk when running a trace hook that raises an
exception not caught by the hook, the program terminates -- whether or not
there is a rescue further up the call stack, i.e. in the non-hook body.

Ruby 1.9 also gives a stack trace, while Ruby 1.8 doesn't.

How do JRuby, IronRuby and Rubinius and other Rubies handle this? And what
do the specifications say?

If it is the case that raising an exception in a trace hook unconditionally
terminates the hooked program, programmers that want to write a trace hook
that plays nice with programs it hooks against should wrap the hook in a
begin/rescue block. Or make sure your code never raises an uncaught
exception.

Here is some test code followed by output:

s = Proc.new {  # line 1
  |event, file, lineno, mid, binding, klass|  # line 2
  puts "#{event} #{mid} :#{lineno}"   # line 3
  raise RuntimeError   # line 4
}   # line 5
begin   # line 6
  set_trace_func(s)   # line 7
  puts "after trace func"  # line 8
rescue   # line 9
  puts "Rescued"  # line 10
end   # line 11


For Ruby 1.8.7 2009-07-12 patchlevel 174:

$ /usr/bin/ruby trace-bug.rb
line  trace-bug.rb:8
line  trace-bug.rb:10
c-call backtrace trace-bug.rb:10
c-call write trace-bug.rb:10

For Ruby 1.9 trunk (Rev 26961):

$ ./ruby trace-bug.rb
c-return set_trace_func trace-bug.rb:7
c-call === trace-bug.rb:10
trace-bug.rb:4:in `block in <main>': RuntimeError (RuntimeError)
    from trace-bug.rb:10:in `rescue in <main>'
    from trace-bug.rb:6:in `<main>'

By the way, also note that Ruby 1.9 includes as a trace event the C return
from set_trace_func. I find this not quite right. In a patch to an
experimental Ruby to add better debugging support, this event is removed.

I'll open a ticket in Redmine if it is decided this is something worth
reporting.

Thanks.

In This Thread

Prev Next