Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Code Bug causes SegFault #1269

levmatta-umanni opened this Issue · 3 comments

4 participants


I have been tracking this bug for quite some time with the Ruby Core Issue#5986 team and then with EventMachine Issue#318.

It turns out that an infinite loop is caused by and Arbre::HTML::Element#to_ary method, as explained by note #13.
It seams that this is somewhat out of place.

Please Verify.


Relevant portion of the linked issue on Ruby Core for those interested:

Arbre::HTML::Element (which is defined in active_admin) defines #to_ary wrongly, as the class does not mimic Array class.

  def to_ary [self]

(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 [self]

(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:

I played around with this a little bit on my system (32-bit ubuntu) and it does segfault with the example code he posted (on 1.9.3-p125, latest 1.9.3 I think).

If you just define to_a instead of to_ary, everything works fine. I have not run the test suite but that seems like the fix to me.


Changing to_ary to to_a fails a bunch of tests, I'm going to look into some stuff, may be a fun learning experience.


Arbre is now external to activeadmin. Please open issue there if still a problem

@jpmckinney jpmckinney closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.