Bug #9384

Segfault in ruby 2.1.0p0

Added by Christophe Bliard about 1 year ago. Updated about 1 year ago.

[ruby-core:59642]
Status:Third Party's Issue
Priority:Normal
Assignee:-
ruby -v:- Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN

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.

ruby_stderr.log Magnifier (248 KB) Christophe Bliard, 01/08/2014 07:40 PM

bundle_exec_rake_assets_precompile.1.log Magnifier (247 KB) Christophe Bliard, 01/08/2014 11:29 PM

bundle_exec_rake_assets_precompile.2.log Magnifier (235 KB) Christophe Bliard, 01/08/2014 11:29 PM

ruby_rake_assets_precompile_all.1.log Magnifier (235 KB) Christophe Bliard, 01/08/2014 11:29 PM

ruby_rake_assets_precompile_all.2.log Magnifier (234 KB) Christophe Bliard, 01/08/2014 11:29 PM

bundle_exec_rake_assets_precompile.ruby_trunk.log Magnifier (224 KB) Christophe Bliard, 01/09/2014 02:01 AM

Gemfile.lock.works (8.36 KB) Christophe Bliard, 01/13/2014 10:36 AM

Gemfile.lock.segfaults (8.36 KB) Christophe Bliard, 01/13/2014 10:36 AM

History

#1 Updated by Christophe Bliard about 1 year ago

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)

#2 Updated by Nobuyoshi Nakada about 1 year ago

Could you try with the trunk?

It seems something dead object is used in a finalizer.

#3 Updated by Christophe Bliard about 1 year ago

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.

#4 Updated by Aman Gupta about 1 year ago

Maybe it's related to the ref gem and weak_reference implementation? Can you try without it?

#5 Updated by Nobuyoshi Nakada about 1 year ago

Sure, but ref is pure ruby.

#6 Updated by Christophe Bliard about 1 year ago

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.

#7 Updated by Nobuyoshi Nakada about 1 year ago

  • Status changed from Open to Third Party's Issue

#8 Updated by Christophe Bliard about 1 year ago

So the issue is closed? Is it really a third party issue that causes the segfault?

#9 Updated by Aman Gupta about 1 year 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.

#10 Updated by Aman Gupta about 1 year 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)

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

#11 Updated by Christophe Bliard about 1 year ago

Ok, thank you for your help

Also available in: Atom PDF