Project

General

Profile

Bug #3690

method_missing in a BasicObject's singleton class - infinite recursion segfaults

Added by rbjl (Jan Lelis) over 9 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-05-26 trunk 28028) [i686-linux]
Backport:
[ruby-core:31706]

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

segfault (313 KB) segfault runpaint (Run Paint Run Run), 08/15/2010 02:25 AM
seg.txt (314 KB) seg.txt segfault output of ruby 1.9.2dev (2010-07-11 revision 28618) [i686-linux] rbjl (Jan Lelis), 08/18/2010 12:12 AM

History

#1

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Rejected

=begin
Yes, it does recurse infinitely with any objects.
That's what you code does.

=end

#2

Updated by rbjl (Jan Lelis) over 9 years ago

=begin
But it does not throw a SystemStackError
=end

#3

Updated by RickDeNatale (Rick DeNatale) over 9 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

#4

Updated by runpaint (Run Paint Run Run) over 9 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

#5

Updated by Eregon (Benoit Daloze) over 9 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

#6

Updated by rbjl (Jan Lelis) over 9 years ago

=begin

=end

Also available in: Atom PDF