[ 
https://issues.apache.org/jira/browse/SLING-13432?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Joerg Hoh updated SLING-13432:
------------------------------
    Affects Version/s: Event Impl 4.4.2

> Jobs can remain unassigned despite a matching job consumer being registered
> ---------------------------------------------------------------------------
>
>                 Key: SLING-13432
>                 URL: https://issues.apache.org/jira/browse/SLING-13432
>             Project: Sling
>          Issue Type: Task
>          Components: Event
>    Affects Versions: Event 4.3.18, Event Impl 4.4.2
>            Reporter: Joerg Hoh
>            Assignee: Joerg Hoh
>            Priority: Major
>
> Re-enabling topic publication concurrently with registering a consumer for a 
> previously absent topic can leave the consumer available locally but missing 
> from the Discovery-derived routing capabilities.
> h3. Execution sequence
> Initially, consumer A is registered locally, but topic publication is 
> disabled.
> # {{CM Event Dispatcher (Fire ConfigurationEvent: 
> pid=org.apache.sling.event.impl.jobs.JobConsumerManager)}} starts re-enabling 
> publication. {{JobConsumerManager.modified()}} calculates the advertised 
> topics, including A’s topic.
> # The CM Event Dispatcher registers the Discovery property provider. It 
> executes {{propagationService = bundleContext.registerService(...)}}. 
> Registration callbacks are delivered synchronously, so the provider can 
> already be visible to OSGi while {{propagationService}} remains null: the 
> assignment happens only after {{registerService()}} returns.
> # Thread 2 registers consumer B for a previously absent topic during this 
> window. SCR invokes the consumer binding callback, which adds B to the local 
> consumer map.
> # The binding callback incorrectly treats the null registration handle as 
> disabled publication. It calls {{calculateTopics(propagationService != 
> null)}}. This evaluates to {{calculateTopics(false)}} and clears the 
> advertised topic list, despite publication being in the process of becoming 
> enabled.
> # The binding callback skips the update notification. Calling 
> {{setProperties()}} also requires a non-null {{propagationService}}. B 
> remains registered locally, but no notification publishes its topic.
> # The CM Event Dispatcher finishes registering the provider. 
> {{registerService()}} returns and its handle is assigned to 
> {{propagationService}}. Nothing recalculates or republishes the topics 
> afterward.
> # {{Apache Sling Job Topology Listener Thread}} processes the resulting 
> Discovery topology. Depending on when Discovery read the provider, its 
> advertisement contains the earlier topics or no topics. Neither includes B’s 
> topic, so the installed routing capabilities lack B.
> # Subsequent {{addJob()}} calls for B’s topic find no target. Routing uses 
> the Discovery-derived capabilities rather than the local consumer map. Jobs 
> are persisted unassigned even though a matching consumer is locally available.
> h3. Impact
> The incorrect state can persist after both registration calls have completed, 
> without any thread remaining blocked. Further job submissions do not refresh 
> the capabilities.
> A successful republication, such as another enabled configuration update or a 
> consumer registration introducing another new topic, can repair the state. 
> Registering an additional consumer for an already-known topic does not 
> trigger republication.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to