Skip to content

Commit

Permalink
Merge pull request #2943 from ganmacs/fix-keepalive-memory-leak
Browse files Browse the repository at this point in the history
Creating timer of purging obsolete sockets if keepalive_timeout is nil
  • Loading branch information
ganmacs committed Apr 13, 2020
2 parents 0e901e7 + e95740b commit a8b6d6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def start
end
end

if @keepalive && @keepalive_timeout
if @keepalive
timer_execute(:out_forward_keep_alived_socket_watcher, @keep_alive_watcher_interval, &method(:on_purge_obsolete_socks))
end
end
Expand Down
9 changes: 9 additions & 0 deletions test/plugin/test_out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,15 @@ def plugin_id_for_test?
end
end

test 'create timer of purging obsolete sockets' do
output_conf = CONFIG + %[keepalive true]
d = create_driver(output_conf)

mock(d.instance).timer_execute(:out_forward_heartbeat_request, 1).once
mock(d.instance).timer_execute(:out_forward_keep_alived_socket_watcher, 5).once
d.instance_start
end

sub_test_case 'with require_ack_response' do
test 'Create connection per send_data' do
target_input_driver = create_target_input_driver(conf: TARGET_CONFIG)
Expand Down

0 comments on commit a8b6d6f

Please sign in to comment.