Bug #9384
closedSegfault in ruby 2.1.0p0
Description
I got a stacktrace while capistrano was deploying our rails app to our server. We switched to ruby 2.1.0 recently. It worked on my dev station, not in staging.
I attached the ruby stderr as output by capistrano and every line was prepended with '*** [err :: hostname.com] '. I removed them for clarity. It looks like some output has been modified by capistrano too.
If you need further data, please tell me.
Files
Updated by cbliard (Christophe Bliard) over 10 years ago
- File bundle_exec_rake_assets_precompile.1.log bundle_exec_rake_assets_precompile.1.log added
- File bundle_exec_rake_assets_precompile.2.log bundle_exec_rake_assets_precompile.2.log added
- File ruby_rake_assets_precompile_all.1.log ruby_rake_assets_precompile_all.1.log added
- File ruby_rake_assets_precompile_all.2.log ruby_rake_assets_precompile_all.2.log added
I tried with ruby-2.1.0-head installed with RVM. It downloaded ruby from ruby_2_1 branch, SHA 41deb12e9d6646b42ef0e011509870f6ddf383c5.
ruby -v: ruby 2.1.1p2 (2013-12-31 revision 44467) [x86_64-linux]
It still segfaults with this latest ruby. I narrowed the command to bundle exec rake assets:precompile
. It always segfaults, but at different times.
When I run the underlying command /home/cbliard/.rvm/rubies/ruby-2.1.0-head/bin/ruby /home/cbliard/.rvm/rubies/ruby-2.1.0-head/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
, it segfaults too in the same manner, but sometimes it passes.
I attached 2 logs of segfaulting bundle, and 2 logs of segfaulting rake. All made with ruby 2.1.1p2 (2013-12-31 revision 44467)
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
Could you try with the trunk?
It seems something dead object is used in a finalizer.
Updated by cbliard (Christophe Bliard) over 10 years ago
- File bundle_exec_rake_assets_precompile.ruby_trunk.log bundle_exec_rake_assets_precompile.ruby_trunk.log added
With 2.0.0, it works (ruby -v is "ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]").
With trunk, it still segfaults (ruby -v is "ruby 2.2.0dev (2014-01-08 trunk 44527) [x86_64-linux]"). I attached the log bundle_exec_rake_assets_precompile.ruby_trunk.log
You are right, it segfaults during cleanup, after all assets have been generated.
Updated by tmm1 (Aman Karmani) over 10 years ago
Maybe it's related to the ref gem and weak_reference implementation? Can you try without it?
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
Sure, but ref
is pure ruby.
Updated by cbliard (Christophe Bliard) over 10 years ago
- File Gemfile.lock.works Gemfile.lock.works added
- File Gemfile.lock.segfaults Gemfile.lock.segfaults added
Aman Gupta wrote:
Maybe it's related to the ref gem and weak_reference implementation? Can you try without it?
No I can't because ref is required by therubyracer gem, which is needed for rails assets precompilation. So I tried updating ref gem.
After running bundle update therubyracer
, the updated gems are:
- therubyracer from 0.11.3 to 0.12.0
- libv8 from 3.11.8.17 to 3.16.14.3
- ref from 1.0.2 to 1.0.5
It seems to fix it: I tried multiple times and it has always worked. I tried with these rubies:
- ruby 2.1.0 (ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux])
- ruby 2.1.1 (ruby 2.1.1p2 (2013-12-31 revision 44467) [x86_64-linux])
- ruby 2.2.0 (ruby 2.2.0dev (2014-01-08 trunk 44527) [x86_64-linux])
I do not know if the culprit is ref, libv8 or therubyracer. I joined the Gemfile.lock files: one when it segfaults and one when it works.
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Status changed from Open to Third Party's Issue
Updated by cbliard (Christophe Bliard) over 10 years ago
So the issue is closed? Is it really a third party issue that causes the segfault?
Updated by tmm1 (Aman Karmani) over 10 years ago
The changelog for therubyracer says:
0.12.0 2013/08/20
- enable native (and functional) weakref implementation for MRI > 2.0
It seems likely this fixed your issue.
Updated by tmm1 (Aman Karmani) over 10 years ago
- ruby -v changed from ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux] to -
Issue #9384 has been updated by Aman Gupta.
The changelog for therubyracer says:
0.12.0 2013/08/20
- enable native (and functional) weakref implementation for MRI > 2.0
It seems likely this fixed your issue.
Bug #9384: Segfault in ruby 2.1.0p0
https://bugs.ruby-lang.org/issues/9384#change-44285
- Author: Christophe Bliard
- Status: Third Party's Issue
- Priority: Normal
- Assignee:
- Category:
- Target version:
- ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
- Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
I got a stacktrace while capistrano was deploying our rails app to our server. We switched to ruby 2.1.0 recently. It worked on my dev station, not in staging.
I attached the ruby stderr as output by capistrano and every line was prepended with '*** [err :: hostname.com] '. I removed them for clarity. It looks like some output has been modified by capistrano too.
If you need further data, please tell me.
---Files--------------------------------
ruby_stderr.log (248 KB)
bundle_exec_rake_assets_precompile.1.log (247 KB)
bundle_exec_rake_assets_precompile.2.log (235 KB)
ruby_rake_assets_precompile_all.1.log (235 KB)
ruby_rake_assets_precompile_all.2.log (234 KB)
bundle_exec_rake_assets_precompile.ruby_trunk.log (224 KB)
Gemfile.lock.works (8.36 KB)
Gemfile.lock.segfaults (8.36 KB)
Updated by cbliard (Christophe Bliard) about 10 years ago
Ok, thank you for your help