diff --git a/lib/fluent/plugin_helper/server.rb b/lib/fluent/plugin_helper/server.rb index ba0c3dc645..a7609b73df 100644 --- a/lib/fluent/plugin_helper/server.rb +++ b/lib/fluent/plugin_helper/server.rb @@ -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 + host: peeraddr[3], host: peeraddr[2], port: peeraddr[1], error: e close rescue nil end