Skip to content

Commit eade741

Browse files
committed
server: close all connections correctly at shutdown
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
1 parent 41d5102 commit eade741

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/fluent/plugin_helper/server.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ def stop
356356
end
357357

358358
def shutdown
359-
@_server_connections.each do |conn|
359+
# When it invokes conn.cose, it reduces elements in @_server_connections by close_callback,
360+
# and it reduces the number of loops. This prevents the connection closing.
361+
# So, it requires invoking #dup to avoid the problem.
362+
@_server_connections.dup.each do |conn|
360363
conn.close rescue nil
361364
end
362365

0 commit comments

Comments
 (0)