Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-157

Race condition when instantiating tools

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 3.0
    • Component/s: GenericTools, Misc
    • Labels:
      None
    • Environment:
      Linux/Tomcat

      Description

      Hello,

      Since Velocity tools are lazy-loaded when necessary only, there's a (wide) race condition problem during tools instantiation.

      Until the tool has been constructed, configure()'d and init()'d, it is not accessible in the toolbox cache and every invocation of the tool triggers a new Construct(), configure() and init().

      The problem is unavoidable with any tool for which initialization takes a few seconds on a heavy enough traffic - for example my Lucene-based search tool gets typically instantiated two or three times on my production servers, and can get instantiated dozens of time on an artificially generated load (siege for example).

      The following patch fixes that.

      I hope it's good enough to get incorporated, if not, I'm willing to put more work in it.

      Thanks for your help !

        Attachments

          Activity

            People

            • Assignee:
              cbrisson Claude Brisson
              Reporter:
              colinleroy Colin Leroy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: