How to solve the "[BUG] Segmentation fault"?

21,260

Solution 1

EDITED: Based on the information you have provided so far, it seems like you have found a bug in Ruby 1.9.3. I recommend that you report this to the Ruby core team.

Until this bug is fixed, you must find a way around it. To find a way around it, you must get more details about exactly what does and does not trigger it.

In the stack trace which you posted, it looks like line 68 of bundler/runtime.rb is requiring the yard gem. Using Ruby 1.9.3, try requiring the yard gem yourself, from IRB or a simple test script. Does that trigger the error? If not, go to the method which "realer" is calling in "bundler" (bundler.rb, line 118). Try calling that method (whatever it is) yourself, from a test script. Does that trigger the error? ...and so on.

Fortunately, when you install Ruby gems, the source code is available in the "gems" directory, and you can study and modify it. I have also had to "hack" the source code of my gems before to work around problems (until a fixed version of the gem is released).

Solution 2

I have the same issue, random crashes related supposedly to Yard when running rspec.

I found another post that fixed the issue for me. Removed 'pry-doc' dependency.

StackOverflow Post

Share:
21,260
Backo
Author by

Backo

Updated on April 15, 2020

Comments

  • Backo
    Backo about 4 years

    I am using a Mac OS running Snow Leopard 10.6.8 and RVM 1.10.3, Ruby 1.9.3-p125, Ruby on Rails 3.2.2 and rspec-rails-2.8.1. I have properly installed and configured all gems, but when in the Terminal window I run the rake spec command I get the following:

    $ rake spec
    /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/yard-0.7.5/lib/yard/cli/command.rb:10: [BUG] Segmentation fault
    ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
    
    -- Control frame information -----------------------------------------------
    c:0045 p:0011 s:0136 b:0136 l:000135 d:000135 CLASS  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/yard-0.7.5/lib/yard/cli/command.rb:10
    c:0044 p:0011 s:0134 b:0134 l:000133 d:000133 CLASS  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/yard-0.7.5/lib/yard/cli/command.rb:4
    c:0043 p:0021 s:0132 b:0132 l:000131 d:000131 TOP    /<ABSOLUT_PATH>/.rvm/gems/ruby-
    1.9.3-p125/gems/yard-0.7.5/lib/yard/cli/command.rb:3
    c:0033 p:0220 s:0104 b:0104 l:0020f0 d:0020f0 TOP    /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/yard-0.7.5/lib/yard.rb:57
    c:0032 p:---- s:0101 b:0101 l:000100 d:000100 FINISH
    c:0031 p:---- s:0099 b:0099 l:000098 d:000098 CFUNC  :require
    c:0030 p:0026 s:0095 b:0095 l:000380 d:000470 BLOCK  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/runtime.rb:68
    c:0029 p:---- s:0092 b:0092 l:000091 d:000091 FINISH
    c:0028 p:---- s:0090 b:0090 l:000089 d:000089 CFUNC  :each
    c:0027 p:0091 s:0087 b:0087 l:000380 d:000408 BLOCK  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/runtime.rb:66
    c:0026 p:---- s:0081 b:0081 l:000080 d:000080 FINISH
    c:0025 p:---- s:0079 b:0079 l:000078 d:000078 CFUNC  :each
    c:0024 p:0046 s:0076 b:0076 l:000380 d:000380 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/runtime.rb:55
    c:0023 p:0021 s:0072 b:0072 l:0004e0 d:0004e0 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler.rb:118
    c:0022 p:0089 s:0068 b:0068 l:000548 d:000548 TOP    /<ABSOLUT_PATH>/Sites/<APPLICATION_NAME>/config/application.rb:7
    c:0021 p:---- s:0066 b:0066 l:000065 d:000065 FINISH
    c:0020 p:---- s:0064 b:0064 l:000063 d:000063 CFUNC  :require
    c:0019 p:0026 s:0060 b:0060 l:0005a8 d:0005a8 TOP    /<ABSOLUT_PATH>/Sites/<APPLICATION_NAME>/config/environment.rb:2
    c:0018 p:---- s:0058 b:0058 l:000057 d:000057 FINISH
    c:0017 p:---- s:0056 b:0056 l:000055 d:000055 CFUNC  :require
    c:0016 p:0058 s:0052 b:0052 l:000608 d:000608 TOP    /<ABSOLUT_PATH>/Sites/<APPLICATION_NAME>/spec/spec_helper.rb:3
    c:0015 p:---- s:0050 b:0050 l:000049 d:000049 FINISH
    c:0014 p:---- s:0048 b:0048 l:000047 d:000047 CFUNC  :require
    c:0013 p:0011 s:0044 b:0044 l:000668 d:000668 TOP    /<ABSOLUT_PATH>/Sites/<APPLICATION_NAME>/spec/controllers/users_controller_spec.rb:1
    c:0012 p:---- s:0042 b:0042 l:000041 d:000041 FINISH
    c:0011 p:---- s:0040 b:0040 l:000039 d:000039 CFUNC  :load
    c:0010 p:0025 s:0036 b:0036 l:0006c8 d:000730 BLOCK  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698
    c:0009 p:---- s:0033 b:0033 l:000032 d:000032 FINISH
    c:0008 p:---- s:0031 b:0031 l:000030 d:000030 CFUNC  :map
    c:0007 p:0023 s:0028 b:0028 l:0006c8 d:0006c8 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698
    c:0006 p:0074 s:0025 b:0025 l:0007a8 d:0007a8 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22
    c:0005 p:0055 s:0020 b:0020 l:000820 d:000820 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80
    c:0004 p:0101 s:0014 b:0014 l:0008a8 d:0008a8 METHOD /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69
    c:0003 p:0021 s:0007 b:0006 l:001788 d:000908 BLOCK  /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10
    c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
    c:0001 p:0000 s:0002 b:0002 l:002388 d:002388 TOP
    
    -- C level backtrace information -------------------------------------------
    
       See Crash Report log file under ~/Library/Logs/CrashReporter or
       /Library/Logs/CrashReporter, for the more detail of.
    
    -- Other runtime information -----------------------------------------------
    
    * Loaded script: /<ABSOLUT_PATH>/.rvm/gems/ruby-1.9.3-p125/bin/rspec
    
    * Loaded features:
    
        0 enumerator.so
        1 /<ABSOLUT_PATH>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/encdb.bundle
        2 /<ABSOLUT_PATH>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin10.8.0/enc/trans/transdb.bundle
        3 /<ABSOLUT_PATH>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
        ...
    
    [NOTE]
    You may have encountered a bug in the Ruby interpreter or extension libraries.
    Bug reports are welcome.
    For details: http://www.ruby-lang.org/bugreport.html
    
    rake aborted!
    /<ABSOLUT_PATH>/.rvm/rubies/ruby-1.9.3-p125/bin/ruby -S rspec ./spec/controllers/users_controller_spec.rb ... failed
    

    How can I solve the issue?

    Note: I noted that the problem happens sometimes, randomly!


    In my Gemfile I have:

    ...
    
    group :development, :test do
      gem "rspec-rails"
      gem 'webrat'
    end
    
    group :test do
      gem 'factory_girl_rails'
      gem 'cucumber-rails'
      gem 'turn', :require => false
    end
    
    ...