Joerg Hoh created SLING-13262:
---------------------------------
Summary: BundledScriptTracker.refreshDispatcher() is not
thread-safe
Key: SLING-13262
URL: https://issues.apache.org/jira/browse/SLING-13262
Project: Sling
Issue Type: Improvement
Components: Servlets
Affects Versions: Servlets Resolver 3.0.6
Reporter: Joerg Hoh
h3. Summary
BundledScriptTracker.refreshDispatcher() performs a non-atomic
read-modify-write on the shared dispatchers map and mutates the
currently-published map in place. When two bundles carrying sling.resourceType
capabilities are installed and/or uninstalled at (nearly) the same time, the
two refreshDispatcher() invocations interleave and leave the DispatcherServlet
registrations in an inconsistent state.
h3. Symptom
After concurrent bundle lifecycle events involving bundled scripts, one or more
of the following is observed:
* Bundled scripts stop resolving. A resource type provided by a freshly
installed bundle is not served by its script — requests fall through to the
default servlet or a less-specific script, producing wrong output or 404/500
responses. The scripts are physically present in the bundle but the resolver
has no DispatcherServlet registered for their resource type.
* IllegalStateException: Service already unregistered logged from
ServiceRegistration.unregister(), thrown out of the bundle-tracker callback.
* Stale dispatchers remain registered. A resource type from an uninstalled
bundle keeps being served by a leftover DispatcherServlet, so an old/removed
script continues to execute.
* The symptoms are intermittent and load/timing dependent: they appear during
startup (many bundles activating in parallel) or during a coordinated
deployment (several content/script bundles installed or refreshed together),
and typically cannot be reproduced by installing the bundles one at a time.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)