Skip to content

Commit

Permalink
CHEF-2916: Disable GC in popen4 to avoid mythical Ruby 1.8 IO.select bug
Browse files Browse the repository at this point in the history
  • Loading branch information
btm committed Feb 9, 2012
1 parent e7360a2 commit 64f5dd0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chef/lib/chef/mixin/command/unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ module Unix
#
# Thanks Ara!
def popen4(cmd, args={}, &b)
# Ruby 1.8 suffers from intermittent segfaults believed to be due to GC while IO.select
# See CHEF-2916 / CHEF-1305
GC.disable

# Waitlast - this is magic.
#
Expand Down Expand Up @@ -207,6 +210,8 @@ def popen4(cmd, args={}, &b)
else
[cid, pw.last, pr.first, pe.first]
end
ensure
GC.enable
end

end
Expand Down

0 comments on commit 64f5dd0

Please sign in to comment.