summaryrefslogtreecommitdiff
path: root/lib/mixlib/shellout/unix.rb
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2012-02-22 12:56:06 -0800
committerDaniel DeLeo <dan@opscode.com>2012-02-22 13:01:38 -0800
commit6b7ee13e87baec291d982c5d2d81c32866214a49 (patch)
treebec9c68740d9b6b68f5a02cfeaed1657a85e15a0 /lib/mixlib/shellout/unix.rb
parentc9eb0082179fdeaaced80dacf4dc8df67ae30817 (diff)
downloadmixlib-shellout-6b7ee13e87baec291d982c5d2d81c32866214a49.tar.gz
[CHEF-2947] properly remove STDERR from list of fds to select/read
Properly remove child's stderr pipe from the list of IO objects to select on in the case that stdout has already been removed from the list. This prevents a situation where the stdout stream is always considered readable by select (because it has reached eof) but ShellOut would attempt to read from it in a tight loop. Since GC is disabled while a command is running, this would generate a bunch of EOFError objects that were not reaped and use a ton of heap space.
Diffstat (limited to 'lib/mixlib/shellout/unix.rb')
-rw-r--r--lib/mixlib/shellout/unix.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mixlib/shellout/unix.rb b/lib/mixlib/shellout/unix.rb
index 243ca24..fe307b5 100644
--- a/lib/mixlib/shellout/unix.rb
+++ b/lib/mixlib/shellout/unix.rb
@@ -185,7 +185,7 @@ module Mixlib
end
rescue Errno::EAGAIN
rescue EOFError
- open_pipes.delete_at(0)
+ open_pipes.delete(child_stdout)
end
def read_stderr_to_buffer
@@ -194,7 +194,7 @@ module Mixlib
end
rescue Errno::EAGAIN
rescue EOFError
- open_pipes.delete_at(1)
+ open_pipes.delete(child_stderr)
end
def fork_subprocess