Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault with rspec #39

Closed
erwanlr opened this issue Mar 4, 2013 · 23 comments
Closed

Segmentation fault with rspec #39

erwanlr opened this issue Mar 4, 2013 · 23 comments

Comments

@erwanlr
Copy link
Contributor

erwanlr commented Mar 4, 2013

I have the following output at the end of rspec with https://github.com/wpscanteam/wpscan :

/home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ethon-0.5.10/lib/ethon/multi.rb:26: [BUG] Segmentation fault
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC  :multi_cleanup
c:0004 p:0024 s:0008 b:0008 l:0001c0 d:000007 BLOCK  /home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ethon-0.5.10/lib/ethon/multi.rb:26
c:0003 p:---- s:0006 b:0006 l:000005 d:000005 FINISH
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 CFUNC  :call
c:0001 p:0000 s:0002 b:0002 l:001698 d:001698 TOP   

-- Ruby level backtrace information ----------------------------------------
/home/erwan/.rvm/gems/ruby-1.9.3-p362/bin/rspec:0:in `call'
/home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ethon-0.5.10/lib/ethon/multi.rb:26:in `block in finalizer'
/home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ethon-0.5.10/lib/ethon/multi.rb:26:in `multi_cleanup'

-- C level backtrace information -------------------------------------------
Segmentation fault
$ curl --version
curl 7.29.0 (x86_64-unknown-linux-gnu) libcurl/7.29.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz
@hanshasselberg
Copy link
Member

Thanks for reporting! Will look into it.

@deanmarano
Copy link

I'm seeing this issue as well - any ideas as to what it could be?

@hanshasselberg
Copy link
Member

@deanmarano How can I reproduce it?

@erwanlr
Copy link
Contributor Author

erwanlr commented Mar 12, 2013

(If you want a smaller piece of code, this one https://gist.github.com/erwanlr/5099652 also have the issue)

@dwaynemac
Copy link

i'm having this problem too.

@dwaynemac
Copy link

has anyone found some work around at least? I can't even run rake tasks :(

@erwanlr
Copy link
Contributor Author

erwanlr commented Apr 9, 2013

With the master version, the error is the same but from a different gem :o

/home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ffi-1.6.0/lib/ffi/autopointer.rb:158: [BUG] Segmentation fault
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0082 p:---- s:0326 b:0326 l:000325 d:000325 CFUNC  :multi_cleanup
c:0081 p:---- s:0324 b:0324 l:000323 d:000323 CFUNC  :call
c:0080 p:0015 s:0320 b:0320 l:000319 d:000319 METHOD /home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ffi-1.6.0/lib/ffi/autopointer.rb:158
c:0079 p:0026 s:0316 b:0316 l:000315 d:000315 METHOD /home/erwan/.rvm/gems/ruby-1.9.3-p362/gems/ffi-1.6.0/lib/ffi/autopointer.rb:134

Full Trace : https://gist.github.com/erwanlr/d7728c5728cf046213c6

@jonesdeini
Copy link

Any fix or workaround for this? I get this error when using typhoeus with delayed_job
Here is my mega-long stack trace https://gist.github.com/jonesdeini/360b17b95afaadea7d3c

@hanshasselberg
Copy link
Member

I'll have some time at the end of the week and I'm going to fix some bugs! Will see how hard that one is...

@jonesdeini
Copy link

Let me know if you need any more information or if there is anything I can do to help. Typhoeus is such a cool project and I would love to help out if possible. Thank you for all your hard work!

@hanshasselberg
Copy link
Member

@jonesdeini Thanks for the kind words! Any help is highly appreciated! You could for example go ahead and fix bugs. Some of them are less complex like typhoeus/typhoeus#233 or #32. I you would like to do something else thats cool too. Just email me if you need a pointer if you run into a problem or have question!

@hanshasselberg
Copy link
Member

@erwanlr @dwaynemac @jonesdeini could somebody provide code to reproduce your issue? wpscan test suite works for me and the gist doesn't raise anything. Tested with Typhoeus 0.6.3 and Ethon 0.5.11.

@erwanlr
Copy link
Contributor Author

erwanlr commented May 17, 2013

What version of ruby are you using ?

I've retested the gist (https://gist.github.com/erwanlr/5099652, spec_helper.rb & test_spec.rb have to be moved in a spec directory, then you run rspec), and ruby 1.9.3p194 & 1.9.3p362

Like I said 1 month ago, the error is the same but from a different gem :

erwan@t-009:~/Progs/test/hydra-issue$ rspec 
....

Finished in 0.02571 seconds
4 examples, 0 failures
/home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:158: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0006 p:---- s:0018 b:0018 l:000017 d:000017 CFUNC  :multi_cleanup
c:0005 p:---- s:0016 b:0016 l:000015 d:000015 CFUNC  :call
c:0004 p:0015 s:0012 b:0012 l:000011 d:000011 METHOD /home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:158
c:0003 p:0026 s:0008 b:0008 l:000007 d:000007 METHOD /home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:134
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a78 d:001a78 TOP   

-- Ruby level backtrace information ----------------------------------------
/home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:134:in `call'
/home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:158:in `release'
/home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:158:in `call'
/home/erwan/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.8.1/lib/ffi/autopointer.rb:158:in `multi_cleanup'

-- C level backtrace information -------------------------------------------
Segmentation fault

@dwaynemac
Copy link

i'll try to look into it. We've downgraded to Typhoeus 0.5.0.alpha and are with this version because we have some deadlines right now. As soon as I can I'll retest this.

@hanshasselberg
Copy link
Member

@erwanlr I've made the following changes - not important imho:

$ git diff
diff --git a/Gemfile b/Gemfile
index cf4084c..9b0e300 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,5 @@
 source "http://rubygems.org"

-gem 'typhoeus', '>=0.6.2'
+gem 'typhoeus', path: "../typhoeus"
 gem 'webmock', '>=1.9.3'
 gem 'rspec', :require => 'spec'
diff --git a/spec_helper.rb b/spec_helper.rb
index 91f968a..a009505 100644
--- a/spec_helper.rb
+++ b/spec_helper.rb
@@ -1,4 +1,4 @@
 # spec/spec_helper.rb

 require 'webmock/rspec'
-require File.expand_path(File.dirname(__FILE__) + '/../test')
+require_relative 'test'
diff --git a/test_spec.rb b/test_spec.rb
index 64258a9..da94664 100644
--- a/test_spec.rb
+++ b/test_spec.rb
@@ -1,6 +1,6 @@
 # spec/test_spec.rb

-require 'spec_helper'
+require_relative 'spec_helper'

 describe Foo do
   let(:url) { 'http://google.com' }
@@ -13,7 +13,7 @@ describe Foo do

       context "when concurrency = #{concurrency}" do
         it 'returns all the files' do
-          foo.retrieve_files(concurrency).should == foo.urls
+          foo.retrieve_files(concurrency).sort.should == foo.urls
         end
       end
     end

and I get the following result:

$ bundle exec rspec test_spec.rb
....

Finished in 0.02728 seconds
4 examples, 0 failures

with the following versions:

$ ruby --version
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.0]
$ curl --version
curl 7.28.0 (x86_64-apple-darwin12.2.0) libcurl/7.28.0 OpenSSL/0.9.8r zlib/1.2.5 c-ares/1.9.1 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz

Edit: I've also just tested it successfully with the latest libcurl version:

$ curl --version
curl 7.30.0 (x86_64-apple-darwin12.3.0) libcurl/7.30.0 OpenSSL/0.9.8r zlib/1.2.5 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz

@erwanlr
Copy link
Contributor Author

erwanlr commented May 17, 2013

Humm, I'm using curl 7.29, and in the 7.30 changelog I saw this : http://sourceforge.net/p/curl/bugs/1194/ (from http://curl.haxx.se/changes.html#7_30_0)

I will update curl to the 7.30 and retry tomorrow

@hanshasselberg
Copy link
Member

Very good catch!

@jonesdeini
Copy link

I upgraded curl to 7.30 and still have the same error.

$ curl --version
curl 7.30.0 (x86_64-unknown-linux-gnu) libcurl/7.30.0 OpenSSL/1.0.1e zlib/1.2.8 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 

It appears my example will be dependant on Rails since delayed_job depends on ActiveRecord.
Hopefully I will be able to extract an example which does not depend on Rails.

@erwanlr
Copy link
Contributor Author

erwanlr commented May 18, 2013

Works for me

@linrock
Copy link
Contributor

linrock commented Jul 28, 2013

I ran rspec against curl versions 7.28.1, 7.29.0, 7.30.0, and 7.31.0. Only 7.29.0 segfaults (in multi_cleanup). Must be because of the bug linked by @erwanlr.

@hanshasselberg
Copy link
Member

thanks @linrock. I'm going to close this issue then. Happy to reopen when necessary.

@AndreasSoiron
Copy link

I got problems with curl 7.30.0 in OS X 10.9. Updating to curl 7.33 fixed it for me.

@hanshasselberg
Copy link
Member

@AndreasSoiron thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants