From 96733faeb735ceaf0906b003d642cec21c641e3b Mon Sep 17 00:00:00 2001 From: Jye Lee <jyelee124@gmail.com> Date: Mon, 4 Mar 2019 13:40:41 -0800 Subject: [PATCH] always close pool connections to avoid zlib warnings previously, we only closed connections when there are no errors. when we hit errors while executing, we saw misleading zlib errors where instead it was just the ssh command failing. so lets always close connections to avoid those errors. --- CHANGELOG.md | 1 + lib/sshkit/backends/netssh.rb | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef2a5a9..f51dde75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ appear at the top. ## [Unreleased][] * Your contribution here! +* [#457](https://github.com/capistrano/sshkit/pull/457): https://github.com/capistrano/sshkit/pull/457 - [@eatwithforks](https://github.com/eatwithforks) * [#455](https://github.com/capistrano/sshkit/pull/455): Ensure UUID of commands are stable in logging - [@lazyatom](https://github.com/lazyatom) ## [1.18.2][] (2019-02-03) diff --git a/lib/sshkit/backends/netssh.rb b/lib/sshkit/backends/netssh.rb index 86538ffa..faf0c756 100644 --- a/lib/sshkit/backends/netssh.rb +++ b/lib/sshkit/backends/netssh.rb @@ -79,10 +79,9 @@ def download!(remote, local=nil, options = {}) # Note that this pool must be explicitly closed before Ruby exits to # ensure the underlying IO objects are properly cleaned up. We register an - # at_exit handler to do this automatically, as long as Ruby is exiting - # cleanly (i.e. without an exception). + # at_exit handler to do this automatically. @pool = SSHKit::Backend::ConnectionPool.new - at_exit { @pool.close_connections if @pool && !$ERROR_INFO } + at_exit { @pool.close_connections if @pool } class << self attr_accessor :pool