From 9043a39c96453ce92d6e0c344edc85063ef1a01b Mon Sep 17 00:00:00 2001 From: Ry Biesemeyer Date: Tue, 11 Sep 2018 21:46:37 +0000 Subject: [PATCH] Fix leak of file handles that prevents gzip files from being cleaned up Use `Zlib::GzipWriter::new(IO)` instead of `Zlib::GzipWriter::open(Object)`, since the latter effectively creates an additional file handle when passed an `IO`. This ensures that when we send `Zlib::GzipWriter#close`, the original `IO` is closed in turn. Resolves: https://github.com/logstash-plugins/logstash-output-s3/issues/190 --- lib/logstash/outputs/s3/temporary_file_factory.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/logstash/outputs/s3/temporary_file_factory.rb b/lib/logstash/outputs/s3/temporary_file_factory.rb index 7695ac02..21a98abe 100644 --- a/lib/logstash/outputs/s3/temporary_file_factory.rb +++ b/lib/logstash/outputs/s3/temporary_file_factory.rb @@ -100,7 +100,7 @@ class IOWrappedGzip def initialize(file_io) @file_io = file_io - @gzip_writer = Zlib::GzipWriter.open(file_io) + @gzip_writer = Zlib::GzipWriter.new(file_io) end def path