Segmentation Fault #122

Closed
miloops opened this Issue Apr 23, 2012 · 10 comments

6 participants

@miloops

Hey, I'm getting a segmentation fault using Ruby 1.9.3:

/Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/excon-0.13.4/lib/excon/ssl_socket.rb:74: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

-- Control frame information -----------------------------------------------
c:0040 p:---- s:0170 b:0170 l:000169 d:000169 CFUNC :connect
c:0039 p:0527 s:0167 b:0167 l:000166 d:000166 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/excon-0.13.4/lib/excon/ssl_socket.rb:74
c:0038 p:---- s:0159 b:0159 l:000158 d:000158 FINISH
c:0037 p:---- s:0157 b:0157 l:000156 d:000156 CFUNC :new
c:0036 p:0064 s:0152 b:0149 l:000148 d:000148 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/excon-0.13.4/lib/excon/connection.rb:326
c:0035 p:0036 s:0146 b:0146 l:000145 d:000145 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/excon-0.13.4/lib/excon/connection.rb:171
c:0034 p:0326 s:0134 b:0134 l:000133 d:000133 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/excon-0.13.4/lib/excon/connection.rb:97
c:0033 p:0109 s:0126 b:0126 l:0004f0 d:0004f0 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/fog-1.3.1/lib/fog/core/connection.rb:20
c:0032 p:0106 s:0118 b:0118 l:000117 d:000117 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/fog-1.3.1/lib/fog/aws/storage.rb:359
c:0031 p:0104 s:0109 b:0109 l:000108 d:000108 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/fog-1.3.1/lib/fog/aws/requests/storage/get_bucket.rb:55
c:0030 p:0055 s:0104 b:0104 l:000103 d:000103 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/fog-1.3.1/lib/fog/aws/models/storage/directories.rb:24
c:0029 p:0067 s:0095 b:0095 l:000094 d:000094 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/asset_sync/storage.rb:18
c:0028 p:0011 s:0092 b:0092 l:000091 d:000091 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/asset_sync/storage.rb:52
c:0027 p:0011 s:0088 b:0088 l:000087 d:000087 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/asset_sync/storage.rb:126
c:0026 p:0023 s:0083 b:0083 l:000082 d:000082 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/asset_sync/storage.rb:140
c:0025 p:0199 s:0080 b:0080 l:000079 d:000079 METHOD /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/asset_sync/asset_sync.rb:29
c:0024 p:0015 s:0077 b:0077 l:001808 d:000076 BLOCK /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/asset_sync-0.3.1/lib/tasks/asset_sync.rake:3
c:0023 p:---- s:0075 b:0075 l:000074 d:000074 FINISH
c:0022 p:---- s:0073 b:0073 l:000072 d:000072 CFUNC :call
c:0021 p:0043 s:0068 b:0068 l:000059 d:000067 BLOCK /Users/miloops/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rake/task.rb:205

I compiled it using standard rbenv installation if that matters.

Thanks!

@mkb

If you are segfaulting then that's ultimately a Ruby issue. From the paths I'm guessing you are on MacOS. Are you running Lion? On rvm-built Rubies under Lion I've seen segfaults go away after updating RVM. It's worth trying the same with rbenv.

@miloops

Yes, I'm indeed on MacOS Lion. Any suggestion to workaround this? I've to change to 1.9.2 to precompile assets and then change back to 1.9.3 to dev.

@geemus

@miloops - I don't really use rbenv so I'm not certain on specifics there. Are you only having this problem in that particular version of installed Ruby or is it happening consistently? I wasn't sure from your comment about switching to/from 1.9.2.

@nextmat

@miloops I've run into segfaults depending on how ruby is built, you may want to look at the OS X GCC installer, more info here: http://stackoverflow.com/questions/6170813/why-cant-i-install-rails-on-lion-using-rvm/7884957#7884957

@mkb

@miloops As I said before, I have seen this same problem with RVM and updating to the current stable version fixed it. I would expect similar behavior from rbenv. I suggest you do the following:
1- uninstall that ruby
2- update rbenv
3- reinstall ruby

If that does not work, uninstall ruby again and retry with rvm.

@miloops

Thanks for the ideas, i'm closing the issue since it's not an excon problem.

@miloops miloops closed this Apr 27, 2012
@geemus

Thanks everybody for jumping in. I hadn't personally run into this one so wasn't sure what the right answer was.

@richardkmichael

Just to get this out to everyone's eyes...

I had this problem yesterday; and I've often had OpenSSL segfaults with Ruby. RVM's --with-opt-dir "fixed" it, discussed below...

I believe it's due to different versions of OpenSSL linked by Ruby and/or extensions, but I could not find the offending Ruby bundles. otool revealed all Ruby native .bundle files were linked against the same (MacPorts) OpenSSL in /opt/local/lib/libssl..., so I was stumped.

In discussion with @mpapis on #rvm IRC, it appears the Ruby build process can detect and link to /opt/local/lib/, but some modules can use headers from elsewhere, e.g. system OpenSSL. There are two solutions, both worked for me, and both require using --with-opt-dir=/opt/local.

  • Upgrade to master RVM, I don't know the commit, but 1.15.9 moving towards 1.16 (I assume anything >1.16, when it's released, would be fine).

  • Continue using stable RVM 1.15.9, but in this case, you must install libyaml to your /opt/local. Stable RVM will not install it's own libyaml if you specify --with-opt-dir. Thus, Macports: port install libyaml, or Homebrew, as you prefer.

Then, in both cases use --with-opt-dir=....

Ex. rvm install ruby-1.9.3-p194 --with-opt-dir=/opt/local.

@mpapis

Just to clarify, it is also important to use gcc-4.2, ruby is not fully clang/LLVM compliant, with know issues for Fibers - but other stuff can fail randomly depending on clang version/build.

@geemus

Thanks for extra details guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment