From: Yusuke Endoh Date: 2010-01-30T23:12:54+09:00 Subject: [ruby-core:27973] [Bug #2692] Ruby hangs after returning from rescue clause inside the block Issue #2692 has been updated by Yusuke Endoh. Category set to core Assigned to set to Koichi Sasada Priority changed from Normal to High Hi Ilya -- 2010/1/30 Ilya Lopatkin : > def foo > some_block = -> do > 0.upto(1000) do |i| > begin > raise Exception.new if i % 500 == 0 > rescue Exception > return > end > end > end > > some_block.call > end > > foo > > VM hangs after return statement and can't be even interrupted via Ctrl+C. > I've tried the latest snapshot and it behaves the same. Good report! Duplicated. Here is a patch: diff --git a/bootstraptest/test_jump.rb b/bootstraptest/test_jump.rb index 7746733..bfb380e 100644 --- a/bootstraptest/test_jump.rb +++ b/bootstraptest/test_jump.rb @@ -259,3 +259,15 @@ assert_normal_exit %q{ end end } + +assert_normal_exit %q{ + -> do + 1.times do + begin + raise + rescue + return + end + end + end.call +} diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 54d54ff..ae1d86d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1491,7 +1491,7 @@ vm_throw(rb_thread_t *th, rb_control_frame_t *reg_cfp, dfp = cfp->dfp; goto valid_return; } - tdfp = GC_GUARDED_PTR_REF((VALUE *)*dfp); + tdfp = GC_GUARDED_PTR_REF((VALUE *)*tdfp); } } } -- Yusuke ENDOH ---------------------------------------- http://redmine.ruby-lang.org/issues/show/2692 ---------------------------------------- http://redmine.ruby-lang.org