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 ...@@ -65,7 +65,15 @@ class WendelinClient
:use_ssl => (uri.scheme == 'https'), :use_ssl => (uri.scheme == 'https'),
# NOTE = "do not check server cert" # NOTE = "do not check server cert"
# TODO move this out to conf parameters # TODO move this out to conf parameters
:verify_mode => OpenSSL::SSL::VERIFY_NONE :verify_mode => OpenSSL::SSL::VERIFY_NONE,
  • @kirr this change has been tested in production now for 7 month, and it works very well so far! Probably it is time for a new release on gemfiles ? Then people installing wendelin with gem install have this fix, too.

  • @klaus, thanks for reminder. I've just released fluent-plugin-wendelin v0.2 with this patch:

    https://rubygems.org/gems/fluent-plugin-wendelin/versions/0.2

    Please let me know whether released gem works for people or not.

    Thanks,
    Kirill

  • @kirr thanks, I notified people to try installing unsing new gem release next time and will let you know about how it goes.

Please register or sign in to reply
# 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| ) do |http|
http.request(req) http.request(req)
end 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