Skip to content

Commit

Permalink
Merge pull request #3483 from fluent/issue3475-fix-crash-on-tls-error…
Browse files Browse the repository at this point in the history
…-log

TLSServer: Fix crash on logging errors
  • Loading branch information
ashie authored Aug 6, 2021
2 parents 50c773b + 5b71d51 commit 28eda36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/fluent/plugin_helper/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,15 @@ def try_tls_accept
return true
end
rescue Errno::EPIPE, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e
peeraddr = (@_handler_socket.peeraddr rescue PEERADDR_FAILED)
@log.trace "unexpected error before accepting TLS connection",
host: @_handler_socket.peeraddr[3], port: @_handler_socket.peeraddr[1], error: e
addr: peeraddr[3], host: peeraddr[2], port: peeraddr[1], error: e
close rescue nil
rescue OpenSSL::SSL::SSLError => e
peeraddr = (@_handler_socket.peeraddr rescue PEERADDR_FAILED)
# Use same log level as on_readable
@log.warn "unexpected error before accepting TLS connection by OpenSSL",
host: @_handler_socket.peeraddr[3], port: @_handler_socket.peeraddr[1], error: e
addr: peeraddr[3], host: peeraddr[2], port: peeraddr[1], error: e
close rescue nil
end

Expand Down

0 comments on commit 28eda36

Please sign in to comment.