Bug #3690
closedmethod_missing in a BasicObject's singleton class - infinite recursion segfaults
Description
=begin
segfaults with all versions that I tested (1.9.3, 1.9.2, 1.9.1)¶
obj = BasicObject.new
def obj.method_missing(m, *args, &block)
send( m, *args, &block )
end
puts obj.seg
=end
Files
Updated by nobu (Nobuyoshi Nakada) about 14 years ago
- Status changed from Open to Rejected
=begin
Yes, it does recurse infinitely with any objects.
That's what you code does.
=end
Updated by rbjl (Jan Lelis) about 14 years ago
=begin
But it does not throw a SystemStackError
=end
Updated by RickDeNatale (Rick DeNatale) about 14 years ago
=begin
Well it does on my Mac
→ rvm use 1.9.2
Using ruby 1.9.2 preview1
~
→ ruby -e'obj = BasicObject.new
quote>
quote> def obj.method_missing(m, *args, &block)
quote> send( m, *args, &block )
quote> end
quote>
quote> puts obj.seg'
-e:4:in method_missing': stack level too deep (SystemStackError) from -e:4:in
method_missing'
from -e:4:in method_missing' from -e:4:in
method_missing'
from -e:4:in method_missing' from -e:4:in
method_missing'
from -e:4:in method_missing' from -e:4:in
method_missing'
from -e:4:in method_missing' ... 1253 levels... from -e:4:in
method_missing'
from -e:4:in method_missing' from -e:4:in
method_missing'
from -e:7:in `'
=end
Updated by runpaint (Run Paint Run Run) about 14 years ago
=begin
I can reproduce on ruby 1.9.3dev (2010-08-13 trunk 28973) [i686-linux] with the OP's script. Attached the output.
=end
Updated by Eregon (Benoit Daloze) about 14 years ago
=begin
On 14 August 2010 17:34, Jan Lelis redmine@ruby-lang.org wrote:
Issue #3690 has been updated by Jan Lelis.
But it does not throw a SystemStackError
At me (OS X), it depends quite much.
(ruby 1.9.3dev (2010-08-13) [x86_64-darwin10.4.0], ruby 1.9.2dev
(2010-08-09 revision 28936) [x86_64-darwin10.4.0])
Running with 1.9.{2,3} as a script produce a SystemStackError.
However, sometimes, running in IRB or with 'GC.stress = true' cause
segfault, with 1.9.3.
So it is a 1.9.3-specific problem at me. (1.9.2 with GC.stress take a
while so I suppose there is no problem)
B.D.
=end
Updated by rbjl (Jan Lelis) about 14 years ago
=begin
=end