HomePhorge

Fixed #2294 - Classes sometimes cannot be found
11c0fb77230eUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

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>

Details

Provenance
Markus Roberts <Markus@reality.com>Authored on
James Turnbull <james@lovedthanlost.net>Committed on Aug 2 2009, 11:36 PM
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU7e5b56212eef: Adding #2477 - puppet can apply provided catalogs
Branches
Unknown
Tags
Unknown

Event Timeline

James Turnbull <james@lovedthanlost.net> committed rPU11c0fb77230e: Fixed #2294 - Classes sometimes cannot be found (authored by Markus Roberts <Markus@reality.com>).Aug 2 2009, 11:36 PM