Commit deaa6b97 authored by Kirill Smelkov's avatar Kirill Smelkov

Don't allow Net::HTTP to hang forever

Net::HTTP has default infinite timeout for opening connection, which,
when other side does not open connection fully, nor rejects connecting,
results in infinite thread hang without any reporting into log.

Fix it by explicitly making all timeouts finite (set to default
Net::HTTP's read_timeout 60 seconds).

/cc @klaus
parent 11c22159
......@@ -65,7 +65,15 @@ class WendelinClient
:use_ssl => (uri.scheme == 'https'),
# NOTE = "do not check server cert"
# TODO move this out to conf parameters
:verify_mode => OpenSSL::SSL::VERIFY_NONE
:verify_mode => OpenSSL::SSL::VERIFY_NONE,
# Net::HTTP default open timeout is infinity, which results
# in thread hang forever if other side does not fully
# establish connection. Default read_timeout is 60 seconds.
# We go safe way and make sure all timeouts are defined.
:ssl_timeout => 60,
:open_timeout => 60,
:read_timeout => 60,
) do |http|
http.request(req)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment