Bug #8673
closedUser rest-client PUT request core dumped
Description
- 
use OpenSSL::X509::Certificate.new generate certificate object 
- 
create client = RestClient::Resource.new object 
- 
use client PUT request, then server crashed 
 code is like as below:
 certificate = OpenSSL::X509::Certificate.new(File.read('file.pem'))client = RestClient::Resource.new(URL, 
 :ssl_client_cert => certificate,
 :ssl_client_key => certificate.public_key,
 :verify_ssl => OpenSSL::SSL::VERIFY_PEER,
 :ssl_ca_file => 'ca-cert.pem')
 response = client.put(xml.to_xml, :content_type =>"application/xml")
Files
        
           Updated by gabrielwei (Hao Wei) over 12 years ago
          Updated by gabrielwei (Hao Wei) over 12 years ago
          
          
        
        
      
      /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:174: [BUG] Segmentation fault
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
-- Control frame information -----------------------------------------------
c:0152 p:---- s:0787 e:000786 CFUNC  :sysread_nonblock
c:0151 p:0067 s:0782 e:000781 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/openssl/buffering.rb:174
c:0150 p:0021 s:0776 e:000774 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/protocol.rb:153
c:0149 p:0021 s:0772 e:000771 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/protocol.rb:134
c:0148 p:0009 s:0766 e:000765 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/protocol.rb:144
c:0147 p:0008 s:0763 e:000762 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:39
c:0146 p:0009 s:0757 e:000756 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:28
c:0145 p:0044 s:0749 e:000748 BLOCK  /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1406 [FINISH]
c:0144 p:---- s:0747 e:000746 CFUNC  :catch
c:0143 p:0024 s:0743 e:000742 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1403
c:0142 p:0061 s:0736 e:000735 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1376
c:0141 p:0055 s:0729 e:000728 METHOD /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51
c:0140 p:0052 s:0723 E:fffff6dc BLOCK  /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:176
c:0139 p:0044 s:0719 e:000718 METHOD /home/hao/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:852
c:0138 p:0269 s:0716 E:fffffd98 METHOD /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:172
c:0137 p:0039 s:0708 e:000707 METHOD /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:64
c:0136 p:0013 s:0703 e:000702 METHOD /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/request.rb:33
c:0135 p:0075 s:0698 e:000697 METHOD /home/hao/.rvm/gems/ruby-2.0.0-p247/gems/rest-client-1.6.7/lib/restclient/resource.rb:76
c:0134 p:0105 s:0691 e:000690 METHOD /home/hao/Work/fi-ware-idm/app/models/xacml_policy.rb:81
        
           Updated by Anonymous about 12 years ago
          Updated by Anonymous about 12 years ago
          
          
        
        
      
      - Priority changed from 6 to Normal
        
           Updated by mml (McClain Looney) about 12 years ago
          Updated by mml (McClain Looney) about 12 years ago
          
          
        
        
      
      I'm seeing regular segfaults along this code path without any fancy ssl-related stuff.
Interestingly, it's blowing up during a spec run, and when I run the segfaulting specification alone, it doesn't segfault.
c:0042 p:---- s:0186 e:000185 CFUNC  :read_nonblock
c:0041 p:0021 s:0182 e:000180 METHOD /usr/local/lib/ruby/2.0.0/net/protocol.rb:153
c:0040 p:0077 s:0178 e:000177 METHOD /usr/local/lib/ruby/2.0.0/net/protocol.rb:104
c:0039 p:0058 s:0170 e:000169 BLOCK  /usr/local/lib/ruby/2.0.0/net/http/response.rb:284
c:0038 p:0117 s:0166 e:000165 METHOD /usr/local/lib/ruby/2.0.0/net/http/response.rb:269
c:0037 p:0007 s:0162 e:000161 METHOD /usr/local/lib/ruby/2.0.0/net/http/response.rb:274
c:0036 p:0082 s:0158 e:000157 METHOD /usr/local/lib/ruby/2.0.0/net/http/response.rb:201
c:0035 p:0007 s:0152 e:000151 METHOD /usr/local/lib/ruby/2.0.0/net/http/response.rb:226
c:0034 p:0039 s:0149 e:000148 METHOD /usr/local/lib/ruby/2.0.0/net/http/response.rb:163
c:0033 p:0096 s:0144 e:000143 BLOCK  /usr/local/lib/ruby/2.0.0/net/http.rb:1412 [FINISH]
c:0032 p:---- s:0142 e:000141 CFUNC  :catch
c:0031 p:0024 s:0138 e:000137 METHOD /usr/local/lib/ruby/2.0.0/net/http.rb:1403
c:0030 p:0061 s:0131 e:000130 METHOD /usr/local/lib/ruby/2.0.0/net/http.rb:1376
c:0029 p:0036 s:0124 e:000123 BLOCK  /usr/local/lib/ruby/2.0.0/net/http.rb:1369
c:0028 p:0044 s:0122 e:000121 METHOD /usr/local/lib/ruby/2.0.0/net/http.rb:852
c:0027 p:0017 s:0119 e:000118 METHOD /usr/local/lib/ruby/2.0.0/net/http.rb:1367
c:0026 p:0030 s:0112 E:001a68 METHOD /home/bby/.gem/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/request.rb:92
        
           Updated by drbrain (Eric Hodel) about 12 years ago
          Updated by drbrain (Eric Hodel) about 12 years ago
          
          
        
        
      
      - Assignee set to MartinBosslet (Martin Bosslet)
Can you include your OpenSSL version? For example, mine is:
$ ruby -ropenssl -e 'p OpenSSL::OPENSSL_VERSION'
"OpenSSL 1.0.1e 11 Feb 2013"
        
           Updated by gabrielwei (Hao Wei) about 12 years ago
          Updated by gabrielwei (Hao Wei) about 12 years ago
          
          
        
        
      
      the version is:
"OpenSSL 1.0.1c 10 May 2012"
        
           Updated by zzak (zzak _) about 10 years ago
          Updated by zzak (zzak _) about 10 years ago
          
          
        
        
      
      - Assignee changed from MartinBosslet (Martin Bosslet) to 7150
        
           Updated by rhenium (Kazuki Yamaguchi) over 9 years ago
          Updated by rhenium (Kazuki Yamaguchi) over 9 years ago
          
          
        
        
      
      - Status changed from Open to Closed
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
I reproduced it. Thanks.
https://github.com/ruby/openssl/pull/56
I believe McClain's is another bug. If it still occurs, could you make a new ticket with more information?
        
           Updated by usa (Usaku NAKAMURA) about 9 years ago
          Updated by usa (Usaku NAKAMURA) about 9 years ago
          
          
        
        
      
      - Status changed from Closed to Feedback
        
           Updated by rhenium (Kazuki Yamaguchi) about 9 years ago
          Updated by rhenium (Kazuki Yamaguchi) about 9 years ago
          
          
        
        
      
      - Status changed from Feedback to Closed
Fixed by 66c1da57eb03 at new upstream1 and imported by r56027 ("import Ruby/OpenSSL 2.0.0.beta.1").