Issue #9657 has been updated by Tieg Zaharia.


It seems like this might not make it out until 2.2. 

If anyone runs into this while on 2.1, I was able to stop the segfaults by using BigDecimal coercion instead of to_d (`BigDecimal_coerce` has the GC guard). If you're using the money gem like above, you might even be able to monkeypatch `to_d`:

~~~
`class Integer < Numeric
  ONE = BigDecimal(1)
  def to_d
    ONE * self
  end
end
`
~~~

Note: the monkeypatch wouldn't be reliable if you're converting Floats tho: `a_float.to_d == (ONE * a_float)` isn't always true.

----------------------------------------
Bug #9657: Segfault in bigdecimal/util.rb Float#to_d
https://bugs.ruby-lang.org/issues/9657#change-46132

* Author: Dieter Komendera
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED
----------------------------------------
We're seeing some segfaults with ActiveRecord (rails 4-1-0 branch) when running on travis ci.

Haven't been able to reproduce yet, but we're seeing about a dozen build failures until now but still wanted to share it.
Maybe someone with more clue about that stuff has some idea what's going on and can point in some direction.

~~~
/home/travis/build/<project>/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/bigdecimal-1.2.5/bigdecimal/util.rb:39: [BUG] Segmentation fault at 0x000000acde0834
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0139 p:---- s:0636 e:000635 CFUNC  :BigDecimal
c:0138 p:0028 s:0631 e:000630 METHOD /home/travis/build/<project>/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0/bigdecimal-1.2.5/bigdecimal/u
c:0137 p:0049 s:0627 e:000626 METHOD /home/travis/build<project>/vendor/bundle/ruby/2.1.0/bundler/gems/rails-00b7a21e592a/activerecord/lib/active_rec
c:0136 p:0035 s:0623 e:000622 METHOD /home/travis/build/<project>vendor/bundle/ruby/2.1.0/bundler/gems/rails-00b7a21e592a/activerecord/lib/active_rec
c:0135 p:0049 s:0619 e:000618 METHOD /home/travis/build/<project>/vendor/bundle/ruby/2.1.0/bundler/gems/rails-00b7a21e592a/activerecord/lib/active_rec
c:0134 p:0105 s:0615 e:000611 BLOCK  /home/travis/build/<project>/vendor/bundle/ruby/2.1.0/bundler/gems/rails-00b7a21e592a/activerecord/lib/active_rec [FINISH]
~~~

---Files--------------------------------
segfault_bigdecimal_ruby211.txt (241 KB)
ruby_2014-03-20-161742_Polaris.crash (132 KB)
backtrace.txt (40.5 KB)


-- 
https://bugs.ruby-lang.org/