ruby-changes:46740
From: nobu <ko1@a...>
Date: Tue, 23 May 2017 21:38:09 +0900 (JST)
Subject: [ruby-changes:46740] nobu:r58855 (trunk): fix FD leaks
nobu 2017-05-23 21:38:01 +0900 (Tue, 23 May 2017) New Revision: 58855 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58855 Log: fix FD leaks * test/net/http/test_http.rb (test_s_start): finish connections to get rid of FD leaks. Modified files: trunk/test/net/http/test_http.rb Index: test/net/http/test_http.rb =================================================================== --- test/net/http/test_http.rb (revision 58854) +++ test/net/http/test_http.rb (revision 58855) @@ -234,17 +234,29 @@ end https://github.com/ruby/ruby/blob/trunk/test/net/http/test_http.rb#L234 module TestNetHTTP_version_1_1_methods def test_s_start - h = Net::HTTP.start(config('host'), config('port')) + begin + h = Net::HTTP.start(config('host'), config('port')) + ensure + h.finish + end assert_equal config('host'), h.address assert_equal config('port'), h.port assert_equal true, h.instance_variable_get(:@proxy_from_env) - h = Net::HTTP.start(config('host'), config('port'), :ENV) + begin + h = Net::HTTP.start(config('host'), config('port'), :ENV) + ensure + h.finish + end assert_equal config('host'), h.address assert_equal config('port'), h.port assert_equal true, h.instance_variable_get(:@proxy_from_env) - h = Net::HTTP.start(config('host'), config('port'), nil) + begin + h = Net::HTTP.start(config('host'), config('port'), nil) + ensure + h.finish + end assert_equal config('host'), h.address assert_equal config('port'), h.port assert_equal false, h.instance_variable_get(:@proxy_from_env) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/