Forum: Ruby-core [Closed] Segfault in bigdecimal/util.rb Float#to_d

1a89a8ff89c39148448a228115925b29?d=identicon&s=25 unknown (Guest)
on 2014-04-27 17:34
(Received via mailing list)
Issue #9657 has been updated by _ wanabe.

Status changed from Open to Closed

I close the ticket for backporting r45015.

I've confirmed that this issue is solved on trunk, by following code.

~~~ruby
require 'bigdecimal'
GC.stress = true
(200..400).each do |i|
  p BigDecimal.new(10 ** i) * BigDecimal.new(10 ** i)
end
~~~

Above can cause SEGV without r45015, but can't with it.
(`GC.stress = true` affects `xrealloc()` because of r45653 and r45656.
Thanks to Sasada-san and Nakada-san.)

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

* Author: Dieter Komendera
* Status: Closed
* 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)
This topic is locked and can not be replied to.