#620: Yielding a block inside a loop in a thread crashes the VM
---------------------------------+------------------------------------------
 Reporter:  hongli...@…          |       Owner:  lsansone...@…        
     Type:  defect               |      Status:  new                  
 Priority:  blocker              |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------
 Yielding a block inside a loop directly in the Thread block results in a
 VM crash:

 {{{
 Assertion failed: ((b->flags & flags) == flags), function
 rb_vm_prepare_block, file dispatcher.cpp, line 1737.
 Abort trap
 }}}

 Interestingly, the problem doesn't occur of the loop is wrapped inside a
 function.

 Reproduce with:

 {{{
 require 'thread'

 def do_yield
         yield
 end

 # This doesn't crash.
 Thread.new do
         do_yield do
         end
         do_yield do
         end
         do_yield do
         end
 end.join

 # This doesn't crash either.
 def do_yield_loop_in_function
         while true
                 do_yield do
                 end
         end
 end
 Thread.new do
         do_yield_loop_in_function
 end.join

 # This crashes.
 Thread.new do
         3.times do
                 do_yield do
                 end
         end
 end.join

 # This crashes too.
 Thread.new do
         while true
                 do_yield do
                 end
         end
 end.join
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/620>
MacRuby <http://macruby.org/>

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to