diff options
author | Markus Roberts <Markus@reality.com> | 2011-02-02 14:12:45 -0800 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2011-02-03 14:26:02 -0800 |
commit | ac8d316a08cffd951a883936a9966388ca3e54ee (patch) | |
tree | 87305e4901810fccf15543ec88f6248c81556926 /lib/puppet/util | |
parent | 2a94c61e6c94b1167ea7b858dc184f9f77a7bfc5 (diff) | |
download | puppet-ac8d316a08cffd951a883936a9966388ca3e54ee.tar.gz puppet-ac8d316a08cffd951a883936a9966388ca3e54ee.tar.xz puppet-ac8d316a08cffd951a883936a9966388ca3e54ee.zip |
Fix for #5755 -- making zaml serialization robust over projected objects
The core problem arose when the fix for #5048 in 31118fe85aca4 introduced a
hook to replace objects dynamically durring serialization so that they could be
projected / rewritten to a different form for backward compatability. The
serialization code assumed that all objects being serialized would remain valid
until the serialization was complete, but nothing retained a copy of the
temporary objects created in the hook.
To resolve this, the serialization layer now maintains a ref to each such object
and clears them (to allow GC) after serialization is complete.
Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
Paired-with: Paul Berry <paul@puppetlabs.com>
Diffstat (limited to 'lib/puppet/util')
-rw-r--r-- | lib/puppet/util/zaml.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb index 14aa90e5f..b22dfc199 100644 --- a/lib/puppet/util/zaml.rb +++ b/lib/puppet/util/zaml.rb @@ -20,6 +20,7 @@ class ZAML def self.dump(stuff, where='') z = new stuff.to_zaml(z) + Label.counter_reset where << z.to_s end # @@ -61,6 +62,7 @@ class ZAML end def initialize(obj) @this_label_number = nil + @obj = obj # prevent garbage collection so that object id isn't reused @@previously_emitted_object[obj.object_id] = self end def to_s |