Joerg Hoh created SLING-13393:
---------------------------------

             Summary: ResourceBundle services can remain registered after 
provider deactivation
                 Key: SLING-13393
                 URL: https://issues.apache.org/jira/browse/SLING-13393
             Project: Sling
          Issue Type: Task
    Affects Versions: i18n 3.0.0, I18N Support 2.6.6
            Reporter: Joerg Hoh


Resource bundle registration can overlap with deactivation of 
{{JcrResourceBundleProvider}}, leaving manually registered {{ResourceBundle}} 
services available after the provider has stopped.

The registry checks whether it is open before registering a service, but that 
check and publication of the resulting registration are not coordinated with 
registry closure.

h2. Example

A request loads the English bundle while the provider is being deactivated:

# The loading thread checks that the registry is open and starts registering 
the English service.
# Deactivation marks the registry closed and unregisters all services currently 
tracked by it.
# The loading thread completes registration and adds the new service to the 
already-closed registry.

The new service was not tracked when deactivation performed cleanup, so it 
remains registered.

The same problem can occur without separate threads: OSGi service registration 
synchronously notifies listeners, and a listener can trigger provider 
deactivation before the registration call returns.

h2. Impact

Component deactivation does not necessarily stop the owning OSGi bundle, for 
example during configuration changes. Leftover services can therefore remain 
discoverable, exposing stale bundle snapshots and potentially accumulating 
alongside registrations from subsequent provider activations. Service-presence 
health checks can also match these leftover services.

h2. Expected behavior

After provider deactivation and any overlapping registration operations have 
completed, no provider-owned ResourceBundle services should remain registered.

An in-progress lookup may still return its constructed bundle, but must not 
leave a service registration behind.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to