Issue #1813 has been updated by Yui NARUSE.

Status changed from Open to Assigned
Assignee set to Motohiro KOSAKI
% Done changed from 100 to 0


----------------------------------------
Bug #1813: Threading seg fault (1.9.1-p129 Linux/Mac)
http://redmine.ruby-lang.org/issues/1813

Author: Charlton Wang
Status: Assigned
Priority: Normal
Assignee: Motohiro KOSAKI
Category: core
Target version: 1.9.x
ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux]


=begin
 I'm not sure if there is a thread stack limitation change that is new to 1.9.1 but the following code now causes a segfault on Linux and Illegal Instruction on the Mac. I know this code is somewhat ridiculous (call stack is attempting to go 1001 levels deep) but this seems to work fine in 1.8.6. If the code is executed outside of a thread, everything works fine as well.
 
 t = Thread.new do
     n = 1000
     n.times do |i|
         Object.class_eval <<EOF
             define_method "foo#{i}" do
                 if i < n-1
                     puts i
                     self.send("foo#{i+1}")
                 else
                     puts "done"
                 end
             end
 EOF
     end
     foo0
 end
 t.join
 
 Thanks,
 Charlton
=end



-- 
http://redmine.ruby-lang.org