Bug #3690
closed
method_missing in a BasicObject's singleton class - infinite recursion segfaults
Added by rbjl (Jan Lelis) over 14 years ago.
Updated over 13 years ago.
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
|
|
- Status changed from Open to Rejected
=begin
Yes, it does recurse infinitely with any objects.
That's what you code does.
=end
=begin
But it does not throw a SystemStackError
=end
=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
=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
=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
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0