Hi,
I’m not sure if this is a bug or “by design”, I have seen some
references that it may be by design.
The problem is it makes debugging very hard in jruby when a thread just
dies with no error messages
printed.
Description of problem…
The following code has a typo, I am printing #{name} instead of #{@name}
What happens in JRuby is the thread dies with no error printed out.
Under C Ruby an error is printed out alerting me to my typo.
Without the `Thread.abort_on_exception= true’ JRuby also prints out an
error and both rubys do the
same thing.
=== Code: thread_bug.rb ====
Thread.abort_on_exception= true
@name= “my name”
t= Thread.new do
puts “thread starting…”
puts “this is a name #{name}”
puts “…exiting thread”
end
puts “waiting for thread”
t.join
puts “Program exiting”
=== end code ===
ruby thread_bug.rb
thread starting…
bug.rb:6: undefined local variable or methodname' for #<Object:0xb7cd299c @name="my name"> (NameError) from bug.rb:4:in
initialize’
from bug.rb:4:in `new’
from bug.rb:4
/opt/jruby/bin/jruby bug.rb
waiting for thread
thread starting…
Program exiting
I’m happy to file a bug report if this indeed is a bug.
Thanks
Jim
–
Jim M., http://blog.wolfman.com
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email