Project

General

Profile

Actions

Bug #463

closed

`Errno::ENOTCONN: Socket is not connected' in test/net/http

Added by znz (Kazuhiro NISHIYAMA) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-dev:35896]

Description

=begin
Mac OS Xで以下のようにErrno::ENOTCONNになります。
その影響で他のテストのいくつかもErrno::EADDRINUSEなどで失敗します。

  1. Error:
    test_certificate_verify_failure(TestNetHTTPS):
    Errno::ENOTCONN: Socket is not connected
    /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/.ext/common/openssl/ssl.rb:157:in shutdown' /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/.ext/common/openssl/ssl.rb:157:in shutdown'
    /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/webrick/server.rb:133:in block in shutdown' /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/webrick/server.rb:128:in each'
    /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/webrick/server.rb:128:in shutdown' /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/test/net/http/utils.rb:34:in teardown'

以下のパッチで直るようなのですが問題ないでしょうか?

Index: lib/webrick/server.rb

--- lib/webrick/server.rb (revision 18748)
+++ lib/webrick/server.rb (working copy)
@@ -130,9 +130,17 @@
addr = s.addr
@logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
end

  •    s.shutdown
    
  •    unless @config[:ShutdownSocketWithoutClose]
    
  •    begin
    
  •      s.shutdown
    
  •    rescue Errno::ENOTCONN
    
  •      # when `Errno::ENOTCONN: Socket is not connected' on some platforms,
    
  •      # call #close instead of #shutdown.
    
  •      # (ignore @config[:ShutdownSocketWithoutClose])
         s.close
    
  •    else
    
  •      unless @config[:ShutdownSocketWithoutClose]
    
  •        s.close
    
  •      end
       end
     }
     @listeners.clear
    

=end

Actions

Also available in: Atom PDF

Like0
Like0