Segmentation fault with ruby 2.0.0p247 leading to

2020-08-26 03:59发布

问题:

Running Rails 4.0, Ruby 2.0.0p247 on OS X Mavericks 1.9

I've encountered an error I've never come across today that I don't understand. When attempting to start my rails server within my project, the server crashes. I did try to reinstall and recompile once, successfully but after successfully running the server twice, it started crashing again.

Any idea what could be causing this and a resolution?

admins-air:renga admin$ rails s
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   the more detail of.

-- Control frame information -----------------------------------------------
c:0033 p:-17556791271642 s:0098 e:000097 TOP    [FINISH]
c:0032 p:---- s:0096 e:000095 CFUNC  :require
c:0031 p:0009 s:0092 e:000091 CLASS  /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:13
c:0030 p:0011 s:0090 e:000089 CLASS  /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:12
c:0029 p:0057 s:0088 e:000087 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:9 [FINISH]
c:0028 p:---- s:0086 e:000085 CFUNC  :require
c:0027 p:0019 s:0082 e:000081 CLASS  /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json.rb:58
c:0026 p:0017 s:0080 e:000079 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json.rb:54 [FINISH]
c:0025 p:---- s:0078 e:000077 CFUNC  :require
c:0024 p:0009 s:0074 e:000073 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object/to_json.rb:3 [FINISH]
c:0023 p:---- s:0072 e:000071 CFUNC  :require
c:0022 p:0071 s:0068 e:000067 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object.rb:11 [FINISH]
c:0021 p:---- s:0066 e:000065 CFUNC  :require
c:0020 p:0023 s:0062 e:000061 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/configuration.rb:3 [FINISH]
c:0019 p:---- s:0060 e:000059 CFUNC  :require
c:0018 p:0015 s:0056 e:000055 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie.rb:2 [FINISH]
c:0017 p:---- s:0054 e:000053 CFUNC  :require
c:0016 p:0007 s:0050 e:000049 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:1 [FINISH]
c:0015 p:---- s:0048 e:000047 CFUNC  :require
c:0014 p:0031 s:0044 e:000043 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:4 [FINISH]
c:0013 p:---- s:0042 e:000041 CFUNC  :require
c:0012 p:0047 s:0038 e:000037 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails.rb:9 [FINISH]
c:0011 p:---- s:0036 e:000035 CFUNC  :require
c:0010 p:0007 s:0032 e:000031 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/all.rb:1 [FINISH]
c:0009 p:---- s:0030 e:000029 CFUNC  :require
c:0008 p:0026 s:0026 e:000025 TOP    /Users/admin/Documents/projects/renga/config/application.rb:3 [FINISH]
c:0007 p:---- s:0024 e:000023 CFUNC  :require
c:0006 p:0014 s:0020 e:000019 BLOCK  /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76 [FINISH]
c:0005 p:---- s:0017 e:000016 CFUNC  :tap
c:0004 p:0586 s:0014 e:000013 TOP    /Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73 [FINISH]
c:0003 p:---- s:0008 e:000007 CFUNC  :require
c:0002 p:0034 s:0004 E:0023c8 EVAL   bin/rails:4 [FINISH]
c:0001 p:0000 s:0002 E:002248 TOP    [FINISH]

bin/rails:4:in `<main>'
bin/rails:4:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
/Users/admin/Documents/projects/renga/config/application.rb:3:in `<top (required)>'
/Users/admin/Documents/projects/renga/config/application.rb:3:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/all.rb:1:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/all.rb:1:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails.rb:9:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails.rb:9:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:4:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:4:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:1:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/engine.rb:1:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie.rb:2:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie.rb:2:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/configuration.rb:3:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/configuration.rb:3:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object.rb:11:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object.rb:11:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object/to_json.rb:3:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/core_ext/object/to_json.rb:3:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json.rb:54:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json.rb:58:in `<module:JSON>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json.rb:58:in `require'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:9:in `<top (required)>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:12:in `<module:JSON>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:13:in `<module:Ext>'
/Users/admin/.rvm/gems/ruby-2.0.0-p247/gems/json-1.8.1/lib/json/ext.rb:13:in `require'

-- C level backtrace information -------------------------------------------

回答1:

I had the same problem, and this worked for me:

bundle exec rails s


回答2:

I had the same problem and bundle exec rails s did not work for me. I had to run:

rm -rf .bundle/ && bundle



回答3:

I believe this has to do with establishing a TLS/openSSL connection. The best way to fix this is to recompile ruby using --with-openssl-dir=/opt/local.

uninstall rvm and use this command to reinstall ruby: rvm install ruby-2.0.0p247 --with-openssl-dir=/opt/local --with-iconv-dir=/opt/local

Hope this helps.