ruby-changes:32181
From: nobu <ko1@a...>
Date: Tue, 17 Dec 2013 16:19:32 +0900 (JST)
Subject: [ruby-changes:32181] nobu:r44260 (trunk): vm_trace.c: isolate exceptions
nobu 2013-12-17 16:19:25 +0900 (Tue, 17 Dec 2013) New Revision: 44260 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44260 Log: vm_trace.c: isolate exceptions * vm_trace.c (rb_postponed_job_flush): isolate exceptions in postponed jobs and restore outer ones. based on a patch by tarui. [ruby-core:58652] [Bug #9168] Modified files: trunk/ChangeLog trunk/test/ruby/test_gc.rb trunk/vm_trace.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44259) +++ ChangeLog (revision 44260) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Dec 17 16:19:09 2013 Nobuyoshi Nakada <nobu@r...> + + * vm_trace.c (rb_postponed_job_flush): isolate exceptions in + postponed jobs and restore outer ones. based on a patch by + tarui. [ruby-core:58652] [Bug #9168] + Tue Dec 17 10:48:04 2013 Aman Gupta <ruby@t...> * configure.in (RUBY_DTRACE_POSTPROCESS): Fix compatibility with Index: vm_trace.c =================================================================== --- vm_trace.c (revision 44259) +++ vm_trace.c (revision 44260) @@ -1511,7 +1511,9 @@ rb_postponed_job_flush(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1511 { rb_thread_t *th = GET_THREAD(); unsigned long saved_postponed_job_interrupt_mask = th->interrupt_mask & POSTPONED_JOB_INTERRUPT_MASK; + VALUE saved_errno = th->errinfo; + th->errinfo = Qnil; /* mask POSTPONED_JOB dispatch */ th->interrupt_mask |= POSTPONED_JOB_INTERRUPT_MASK; { @@ -1530,4 +1532,5 @@ rb_postponed_job_flush(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1532 } /* restore POSTPONED_JOB mask */ th->interrupt_mask &= ~(saved_postponed_job_interrupt_mask ^ POSTPONED_JOB_INTERRUPT_MASK); + th->errinfo = saved_errno; } Index: test/ruby/test_gc.rb =================================================================== --- test/ruby/test_gc.rb (revision 44259) +++ test/ruby/test_gc.rb (revision 44260) @@ -279,6 +279,19 @@ class TestGc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_gc.rb#L279 end end + def test_exception_in_finalizer + bug9168 = '[ruby-core:58652] [Bug #9168]' + assert_normal_exit(<<-'end;', bug9168) + raise_proc = proc {raise} + 10000.times do + ObjectSpace.define_finalizer(Object.new, raise_proc) + Thread.handle_interrupt(RuntimeError => :immediate) {break} + Thread.handle_interrupt(RuntimeError => :on_blocking) {break} + Thread.handle_interrupt(RuntimeError => :never) {break} + end + end; + end + def test_verify_internal_consistency assert_nil(GC.verify_internal_consistency) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/