Bug #463

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

Added by Kazuhiro NISHIYAMA almost 7 years ago. Updated about 4 years ago.

[ruby-dev:35896]
Status:Closed
Priority:Normal
Assignee:GOTOU Yuuzou
ruby -v: Backport:

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

History

#1 Updated by Kazuhiro NISHIYAMA almost 7 years ago

  • Status changed from Open to Closed

=begin
r18777
=end

Also available in: Atom PDF