From: "mame (Yusuke Endoh)" Date: 2012-04-22T10:40:30+09:00 Subject: [ruby-core:44521] [ruby-trunk - Bug #5986][Assigned] Segmentation Fault Issue #5986 has been updated by mame (Yusuke Endoh). Status changed from Feedback to Assigned Assignee set to nobu (Nobuyoshi Nakada) Hello, I cannot reproduce this, but I guess this is a bug of Ruby which is triggered by a bug of active_admin. Arbre::HTML::Element (which is defined in active_admin) defines #to_ary *wrongly*, as the class does not mimic Array class. https://github.com/gregbell/active_admin/blob/master/lib/active_admin/arbre/html/element.rb#L147 def to_ary Collection.new [self] end (The Collection class inherits Array) And, an instance of the class is passed to Kernel.puts, which cause a bug. In short, this is considered like the following small code: class Foo def to_ary Array.new [self] end end puts Foo.new (This code does not cause SEGV in my 32 bit system, but naruse said it does in x86_64) This causes infinite recursion, which leads to stack overflow. This behavior can be also observed in the following stack trace: > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(rb_io_puts+0x157) [0x7fb247a35b07] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x88cdd) [0x7fb247a35cdd] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x17da08) [0x7fb247b2aa08] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x17e7dc) [0x7fb247b2b7dc] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(rb_io_puts+0x157) [0x7fb247a35b07] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x88cdd) [0x7fb247a35cdd] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x17da08) [0x7fb247b2aa08] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(+0x17e7dc) [0x7fb247b2b7dc] > /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9(rb_io_puts+0x157) [0x7fb247a35b07] Because rb_io_puts (the implementation of IO#puts) uses rb_exec_recursive, the infinite recursion should be detected. So, I guess there is something wrong in rb_exec_recursive. Nobu, please check it. -- Yusuke Endoh ---------------------------------------- Bug #5986: Segmentation Fault https://bugs.ruby-lang.org/issues/5986#change-26073 Author: levmatta (Luis Matta) Status: Assigned Priority: Low Assignee: nobu (Nobuyoshi Nakada) Category: core Target version: 1.9.3 ruby -v: ruby 1.9.3p68 (2012-02-08 revision 34493) [x86_64-linux] Simply trying to render the home page of active-admin. I have tested this on Ubuntu 10.04 LTS 64bits, using rvm ruby 1.9.3-head (with and without "rvm pkg install openssl"), and 1.9.2-head. The structure: Nginx 1.0.11 (using ppa), RVM, Thin 1.3.1, Rails 3.2.1, ActiveAdmin 0.4, and stuff. I am using SSL with a custom self-signed Certification Authority. Thanks (Since this broke my new production environment I have set it to Urgent - apologies if it is an abuse) -- http://bugs.ruby-lang.org/