summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2009-11-12 23:30:13 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-11-19 11:21:23 +1100
commitbd5dc649ad55fc4724cafad99852b825adfde182 (patch)
tree8d874e3076cdb6fe47d07e7a9201b26f6520190c
parentc1e47a43df40abd5da04bf147df17f0b53bf0868 (diff)
downloadpuppet-bd5dc649ad55fc4724cafad99852b825adfde182.tar.gz
puppet-bd5dc649ad55fc4724cafad99852b825adfde182.tar.xz
puppet-bd5dc649ad55fc4724cafad99852b825adfde182.zip
Possible workaround for #2824 (MRI GC bug)
This is a moderately ugly workaround for the MRI garbage collection bug (see the ticket for details). I explored several other potential solutions (notably, monkey patching the routines that trigger the bug) but none of them were satisfactory. Monkey patching sub, gsub, sub!, gsub!, etc., for example, either changes the scoping of $~, $1, etc. in a way that could potentially subtly change the meaning of programs or (if you are clever) faithfully reproduces the behaviour of MRI--including the memory leak. I decided to go with the standardized and somewhat obnoxious never- used optional argument as it was easy to automatically insert and should be even easier to automatically find and remove if a better fix is developed. It also should be obtrusive enough to escape accidental removal in refactoring.
-rw-r--r--lib/puppet/application/puppetdoc.rb2
-rw-r--r--lib/puppet/file_serving/base.rb2
-rw-r--r--lib/puppet/indirector/node/ldap.rb2
-rw-r--r--lib/puppet/parser/ast/leaf.rb2
-rw-r--r--lib/puppet/provider/service/daemontools.rb2
-rw-r--r--lib/puppet/provider/service/runit.rb2
-rw-r--r--lib/puppet/provider/zone/solaris.rb2
-rw-r--r--lib/puppet/rails/resource.rb2
-rw-r--r--lib/puppet/sslcertificates/ca.rb4
-rw-r--r--lib/puppet/type/k5login.rb2
-rw-r--r--lib/puppet/util/subclass_loader.rb2
11 files changed, 12 insertions, 12 deletions
diff --git a/lib/puppet/application/puppetdoc.rb b/lib/puppet/application/puppetdoc.rb
index 5656112d0..0a4e0c3c3 100644
--- a/lib/puppet/application/puppetdoc.rb
+++ b/lib/puppet/application/puppetdoc.rb
@@ -192,7 +192,7 @@ Puppet::Application.new(:puppetdoc) do
end
end
- def setup_rdoc
+ def setup_rdoc(dummy_argument=:work_arround_for_ruby_GC_bug)
# consume the unknown options
# and feed them as settings
if @unknown_args.size > 0
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb
index 02132e885..a7ab9b66e 100644
--- a/lib/puppet/file_serving/base.rb
+++ b/lib/puppet/file_serving/base.rb
@@ -22,7 +22,7 @@ class Puppet::FileServing::Base
end
# Return the full path to our file. Fails if there's no path set.
- def full_path
+ def full_path(dummy_argument=:work_arround_for_ruby_GC_bug)
(if relative_path.nil? or relative_path == "" or relative_path == "."
path
else
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 4600a0dd5..dd8cebfac 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -73,7 +73,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
# The attributes that Puppet will stack as array over the full
# hierarchy.
- def stacked_attributes
+ def stacked_attributes(dummy_argument=:work_arround_for_ruby_GC_bug)
Puppet[:ldapstackedattrs].split(/\s*,\s*/)
end
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index b73c781e1..c8ac6f7e3 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -101,7 +101,7 @@ class Puppet::Parser::AST
end
end
- def to_classname
+ def to_classname(dummy_argument=:work_arround_for_ruby_GC_bug)
to_s.downcase.gsub(/[^-\w:.]/,'').sub(/^\.+/,'')
end
diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb
index 2c6c6dbc7..3749f9c2c 100644
--- a/lib/puppet/provider/service/daemontools.rb
+++ b/lib/puppet/provider/service/daemontools.rb
@@ -45,7 +45,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
attr_writer :defpath
# Determine the daemon path.
- def defpath
+ def defpath(dummy_argument=:work_arround_for_ruby_GC_bug)
unless defined?(@defpath) and @defpath
["/var/lib/service", "/etc"].each do |path|
if FileTest.exist?(path)
diff --git a/lib/puppet/provider/service/runit.rb b/lib/puppet/provider/service/runit.rb
index b313fc79c..b8b444e34 100644
--- a/lib/puppet/provider/service/runit.rb
+++ b/lib/puppet/provider/service/runit.rb
@@ -38,7 +38,7 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
class << self
# this is necessary to autodetect a valid resource
# default path, since there is no standard for such directory.
- def defpath
+ def defpath(dummy_argument=:work_arround_for_ruby_GC_bug)
unless defined?(@defpath) and @defpath
["/etc/sv", "/var/lib/service"].each do |path|
if FileTest.exist?(path)
diff --git a/lib/puppet/provider/zone/solaris.rb b/lib/puppet/provider/zone/solaris.rb
index 52007bb25..b047f6984 100644
--- a/lib/puppet/provider/zone/solaris.rb
+++ b/lib/puppet/provider/zone/solaris.rb
@@ -64,7 +64,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
@property_hash.clear
end
- def install
+ def install(dummy_argument=:work_arround_for_ruby_GC_bug)
if @resource[:install_args]
zoneadm :install, @resource[:install_args].split(" ")
else
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb
index 12d321143..984bdc05a 100644
--- a/lib/puppet/rails/resource.rb
+++ b/lib/puppet/rails/resource.rb
@@ -199,7 +199,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
result
end
- def ref
+ def ref(dummy_argument=:work_arround_for_ruby_GC_bug)
"%s[%s]" % [self[:restype].split("::").collect { |s| s.capitalize }.join("::"), self.title.to_s]
end
diff --git a/lib/puppet/sslcertificates/ca.rb b/lib/puppet/sslcertificates/ca.rb
index b5a246969..f6bcbc1f7 100644
--- a/lib/puppet/sslcertificates/ca.rb
+++ b/lib/puppet/sslcertificates/ca.rb
@@ -134,7 +134,7 @@ class Puppet::SSLCertificates::CA
# List certificates waiting to be signed. This returns a list of hostnames, not actual
# files -- the names can be converted to full paths with host2csrfile.
- def list
+ def list(dummy_argument=:work_arround_for_ruby_GC_bug)
return Dir.entries(Puppet[:csrdir]).find_all { |file|
file =~ /\.pem$/
}.collect { |file|
@@ -144,7 +144,7 @@ class Puppet::SSLCertificates::CA
# List signed certificates. This returns a list of hostnames, not actual
# files -- the names can be converted to full paths with host2csrfile.
- def list_signed
+ def list_signed(dummy_argument=:work_arround_for_ruby_GC_bug)
return Dir.entries(Puppet[:signeddir]).find_all { |file|
file =~ /\.pem$/
}.collect { |file|
diff --git a/lib/puppet/type/k5login.rb b/lib/puppet/type/k5login.rb
index 20c03241f..5526fda21 100644
--- a/lib/puppet/type/k5login.rb
+++ b/lib/puppet/type/k5login.rb
@@ -56,7 +56,7 @@ Puppet::Type.newtype(:k5login) do
end
# Return the principals
- def principals
+ def principals(dummy_argument=:work_arround_for_ruby_GC_bug)
if File.exists?(@resource[:name])
File.readlines(@resource[:name]).collect { |line| line.chomp }
else
diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb
index 8776e855c..b71ec7293 100644
--- a/lib/puppet/util/subclass_loader.rb
+++ b/lib/puppet/util/subclass_loader.rb
@@ -72,7 +72,7 @@ module Puppet::Util::SubclassLoader
end
# Retrieve or calculate a name.
- def name
+ def name(dummy_argument=:work_arround_for_ruby_GC_bug)
unless defined? @name
@name = self.to_s.sub(/.+::/, '').intern
end