You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Joerg Hoh (Jira)" <ji...@apache.org> on 2026/07/16 13:53:00 UTC
[jira] [Assigned] (SLING-13262) BundledScriptTracker.refreshDispatcher() is not thread-safe
[ https://issues.apache.org/jira/browse/SLING-13262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joerg Hoh reassigned SLING-13262:
---------------------------------
Assignee: Joerg Hoh
> 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
> Assignee: Joerg Hoh
> Priority: Major
>
> 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)