Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-12471

The ScriptDependencyResolver can wrongly return null values when invoked concurrently

    XMLWordPrintableJSON

Details

    Description

      With caching enabled, under concurrency the ScriptDependencyResolver.resolve can return null values.

      Context: Github

      1. Multiple threads are trying to resolve the same scriptIdentifier
      2. They all proceed to line 133 because the resolutionCache is not yet populated.
      3. One thread gets the writeLock, resolves the result, stores it back into the resolutionCache, and eventually releases the write lock.
      4. now all the other threads waiting on line 133 lock on the writelock one-by-one; and when checking the resolutionCache on line 136, the resolutionCache is already populated; and then they just release the writelock and proceed. But during this time result is never read from the resolutionCache, so it's still null and returned as such.

      This normally happens immediately after startup, when the resolutionCache is still empty.

      Attachments

        Issue Links

          Activity

            People

              radu Radu Cotescu
              joerghoh Joerg Hoh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: