diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 3e9f4d1bc2..c0631b55f1 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1086,6 +1086,28 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| end; end + def test_blocking_backtrace + assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + class Bug < RuntimeError + def backtrace + IO.readlines(IO::NULL) + end + end + bug = Bug.new '[ruby-core:85939] [Bug #14577]' + n = 10000 + i = 0 + n.times do + begin + raise bug + rescue Bug + i += 1 + end + end + assert_equal(n, i) + end; + end + def test_wrong_backtrace assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") begin; diff --git a/thread.c b/thread.c index fad0ce6efc..d7e0d91d7f 100644 --- a/thread.c +++ b/thread.c @@ -392,7 +392,7 @@ unblock_function_set(rb_thread_t *th, rb_unblock_function_t *func, void *arg, in } native_mutex_lock(&th->interrupt_lock); - } while (RUBY_VM_INTERRUPTED_ANY(th->ec) && + } while (!th->ec->raised_flag && RUBY_VM_INTERRUPTED_ANY(th->ec) && (native_mutex_unlock(&th->interrupt_lock), TRUE)); VM_ASSERT(th->unblock.func == NULL); diff --git a/version.h b/version.h index 5f61820826..3b51c13bce 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.0" #define RUBY_RELEASE_DATE "2018-03-20" -#define RUBY_PATCHLEVEL 43 +#define RUBY_PATCHLEVEL 44 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 3