-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Following code doesn't cause a LocalJumpError in JRuby unlike in MRI:
proc do |&block|
Thread.new{ block.call }.join
end.call{ break }Using docker to compare behaviour:
cat << 'RUBY' > test.rb
puts '#' * 60, "Using #{RUBY_DESCRIPTION}"
$stdout.flush
proc do |&block|
Thread.new{ block.call }.join
end.call{ break }
puts "Still alive!"
RUBY
cat test.rb | docker run -i --rm ruby:2.7 ruby
cat test.rb | docker run -i --rm ruby:3.0 ruby
cat test.rb | docker run -i --rm ruby:3.1 ruby
cat test.rb | docker run -i --rm jruby:9.2 jruby
cat test.rb | docker run -i --rm jruby:9.3 jrubyGives following output:
############################################################
Using ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
#<Thread:0x000055eb7e475698 -:5 run> terminated with exception (report_on_exception is true):
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
############################################################
Using ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
#<Thread:0x00005632073b3668 -:5 run> terminated with exception (report_on_exception is true):
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
############################################################
Using ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x86_64-linux]
#<Thread:0x00007f5f06b234e8 -:5 run> terminated with exception (report_on_exception is true):
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
-:6:in `block in <main>': break from proc-closure (LocalJumpError)
from -:5:in `block (2 levels) in <main>'
############################################################
Using jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 25.312-b07 on 1.8.0_312-b07 +jit [linux-x86_64]
Exception in thread "Ruby-0-Thread-1: -:1" org.jruby.ir.runtime.IRBreakJump
Still alive!
############################################################
Using jruby 9.3.2.0 (2.6.8) 2021-12-01 0b8223f905 OpenJDK 64-Bit Server VM 25.312-b07 on 1.8.0_312-b07 +jit [linux-x86_64]
Exception in thread "Ruby-0-Thread-1: -:1" org.jruby.ir.runtime.IRBreakJump
Still alive!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels