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

Joerg Hoh reassigned SLING-13271:
---------------------------------

    Assignee: Joerg Hoh

> Concurrent addJob calls corrupt the unsynchronized roundRobinMap in 
> TopologyCapabilities
> ----------------------------------------------------------------------------------------
>
>                 Key: SLING-13271
>                 URL: https://issues.apache.org/jira/browse/SLING-13271
>             Project: Sling
>          Issue Type: Improvement
>          Components: Event
>    Affects Versions: Event Impl 4.4.0
>            Reporter: Joerg Hoh
>            Assignee: Joerg Hoh
>            Priority: Major
>
> {{TopologyCapabilities.roundRobinMap}} is a plain {{HashMap}} that is 
> read-modify-written ({{{}get{}}} then {{{}put{}}}) without any 
> synchronization. The single shared {{TopologyCapabilities}} instance is 
> reached from the public {{JobManager.addJob(...)}} API (via 
> {{{}detectTarget(...){}}}), which is called by arbitrary client threads with 
> no lock in between, so multiple threads can mutate the same {{HashMap}} 
> concurrently.
> h3. Impact
>  * *Lost updates:* concurrent job submissions for the same topic can read the 
> same round-robin index and be dispatched to the same instance, defeating even 
> job distribution across the cluster.
>  * *Map corruption:* unsynchronized concurrent {{HashMap.put}} can corrupt 
> the map's internal table during resize, causing wrong/stale lookups or a 
> spinning lookup. Because this map backs target selection for all topics, the 
> impact is not limited to the racing topic.



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

Reply via email to