Skip to content

Commit

Permalink
Fix leak of file handles that prevents gzip files from being cleaned up
Browse files Browse the repository at this point in the history
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: #190
  • Loading branch information
yaauie committed Sep 25, 2018
1 parent 23a4f71 commit 9043a39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/logstash/outputs/s3/temporary_file_factory.rb
Expand Up @@ -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
Expand Down

0 comments on commit 9043a39

Please sign in to comment.