Issue #4955 has been updated by Brice Figureau.

Markus Roberts wrote:
> Actually, I've got two ideas of how to deal with the memory leak aspect: we 
> could either get rid of the hash and use the keys themselves as the 
> synchronization objects (by decorating them) which would look something like 
> (this is just a sketch):

Yes that's a good solution. +1
----------------------------------------
Bug #4955: Puppet::Util.sync is not thread safe
http://projects.puppetlabs.com/issues/4955

Author: Markus Roberts
Status: Accepted
Priority: High
Assignee: Markus Roberts
Category: threading
Target version: 
Affected version: 0.24.0
Keywords: 
Branch: 


The routine for issuing reference specific sync objects is tricky to use 
correctly since it is not thread safe (it also appears to leak memory):

<pre>
  # Return the sync object associated with a given resource.
  def self.sync(resource)
    @@syncresources[resource] ||= Sync.new
    @@syncresources[resource]
  end
</pre>

The problem is somewhat muddled by the implication that the key object is a 
resource (and thus may be thread bound) -- in fact many of the code paths use 
something other than a resource as a key.  This also affect threadlock, which 
is built on top of sync.

Apparently I don't "get" irony, so I won't comment on that aspect of the 
situation, but this is still something that ought to be fix (a "bug," to be 
technical).





-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to