summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@opscode.com>2012-09-17 10:14:47 -0700
committerBryan McLellan <btm@opscode.com>2012-09-17 10:14:47 -0700
commit15e23eec2daae75a61c7d29c7af3f489d9278248 (patch)
tree333524f6973d95347ebe1f3ee20257875a8d0ebe
parentdd22b0020894b00b6710a7c9ba5abe8259196cd9 (diff)
downloadmixlib-shellout-15e23eec2daae75a61c7d29c7af3f489d9278248.tar.gz
CHEF-3390: Avoid GC during Marshall.load
Ruby < 1.8.7p369 has a bug related to Marshall.load and GC, so let's disable Garbage Collection a little earlier. http://bugs.ruby-lang.org/issues/4339
-rw-r--r--lib/mixlib/shellout/unix.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/mixlib/shellout/unix.rb b/lib/mixlib/shellout/unix.rb
index aa62272..2788db5 100644
--- a/lib/mixlib/shellout/unix.rb
+++ b/lib/mixlib/shellout/unix.rb
@@ -35,6 +35,15 @@ module Mixlib
@child_pid = fork_subprocess
configure_parent_process_file_descriptors
+
+ # Ruby 1.8.7 and 1.8.6 from mid 2009 try to allocate objects during GC
+ # when calling IO.select and IO#read. Some OS Vendors are not interested
+ # in updating their ruby packages (Apple, *cough*) and we *have to*
+ # make it work. So I give you this epic hack:
+ GC.disable
+
+ # CHEF-3390: Marshall.load on Ruby < 1.8.7p369 also has a GC bug related
+ # to Marshall.load, so try disabling GC first.
propagate_pre_exec_failure
@result = nil
@@ -42,11 +51,6 @@ module Mixlib
write_to_child_stdin
- # Ruby 1.8.7 and 1.8.6 from mid 2009 try to allocate objects during GC
- # when calling IO.select and IO#read. Some OS Vendors are not interested
- # in updating their ruby packages (Apple, *cough*) and we *have to*
- # make it work. So I give you this epic hack:
- GC.disable
until @status
ready = IO.select(open_pipes, nil, nil, READ_WAIT_TIME)
unless ready