diff options
author | Markus Roberts <Markus@reality.com> | 2009-07-29 20:55:24 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-08-03 07:36:43 +1000 |
commit | 11c0fb77230ea5ba28bfe86a1c2a1469095b6c70 (patch) | |
tree | e1d3f7766bad21a2fdf04a1d88080a1a58a43636 /lib/puppet/util/diff.rb | |
parent | 7e5b56212eef22be381a480dcaf38b33620674dd (diff) | |
download | puppet-11c0fb77230ea5ba28bfe86a1c2a1469095b6c70.tar.gz puppet-11c0fb77230ea5ba28bfe86a1c2a1469095b6c70.tar.xz puppet-11c0fb77230ea5ba28bfe86a1c2a1469095b6c70.zip |
Fixed #2294 - Classes sometimes cannot be found
This patch should fix the race condition causing ticket 2294; it extends the loading logic so that:
* initial load attempts are processed (as before),
* recursive load attempts return immediately (as before),
* but subsequent concurrent load attempts from different threads
wait on a semaphore (condition variable) and then retry (e.g.
use the now-valid results of the first thread).
This is a slight modification of the solution I'd originally proposed, to prevent a deadlock
that could have arisen if three or more threads simultaneously attempted to load the same item.
Though it solves the bug as reported, it has room for improvement:
* Failures aren't cached, so repeated attempts will be made to
import invalid items each time they are encountered
* It doesn't address any of the underlying referential ambiguity
(module vs. filename)
* The threading logic should probably be refactored into a separate
class (as a start I encapsulated it in an ad hoc singleton class,
so at least it isn't cluttering up the load method)
Signed-off-by: Markus Roberts <Markus@reality.com>
Diffstat (limited to 'lib/puppet/util/diff.rb')
0 files changed, 0 insertions, 0 deletions