Skip to content

Commit

Permalink
Merge pull request #1581 from fluent/fix-ack-handling
Browse files Browse the repository at this point in the history
Fix ack handling
  • Loading branch information
repeatedly authored May 26, 2017
2 parents 817691e + ae69f72 commit 03e2c3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ def read_ack_from_sock(sock, unpacker)
if raw_data.empty?
log.warn "destination node closed the connection. regard it as unavailable.", host: info.node.host, port: info.node.port
info.node.disable!
rollback_write(info.chunk_id)
return nil
else
unpacker.feed(raw_data)
Expand All @@ -450,6 +451,8 @@ def read_ack_from_sock(sock, unpacker)
log.error "unexpected error while receiving ack message", error: e
log.error_backtrace
ensure
info.sock.close_write rescue nil
info.sock.close rescue nil
@sock_ack_waiting_mutex.synchronize do
@sock_ack_waiting.delete(info)
end
Expand Down Expand Up @@ -492,7 +495,7 @@ def ack_reader

readable_sockets.each do |sock|
chunk_id = read_ack_from_sock(sock, unpacker)
commit_write(chunk_id)
commit_write(chunk_id) if chunk_id
end
rescue => e
log.error "unexpected error while receiving ack", error: e
Expand Down

0 comments on commit 03e2c3a

Please sign in to comment.