Carsten Ziegeler created SLING-13131:
----------------------------------------

             Summary: Multiple JMM visibility issues: non-volatile fields read 
across threads
                 Key: SLING-13131
                 URL: https://issues.apache.org/jira/browse/SLING-13131
             Project: Sling
          Issue Type: Bug
          Components: Event
            Reporter: Carsten Ziegeler


A concurrency review identified several fields that are written from OSGi 
lifecycle/config threads and read from job processing threads without volatile 
or synchronization:

1. JobConsumerManager: propagationService (line 109), topics (line 111), 
allowListMatchers (line 113), denyListMatchers (line 115). With DYNAMIC 
reference policy, bind/unbind happens on arbitrary threads. topics is read from 
getTopics() without synchronization.

2. JobManagerConfiguration.progressLogMaxCount: written in update() (called 
from @Activate/@Modified), read from any thread via getProgressLogMaxCount(). 
Updates from @Modified may not be visible.

3. Environment.APPLICATION_ID: written in EnvironmentComponent.activate(), read 
from many threads. Unlike THREAD_POOL on the same class, it lacks volatile. 
Inconsistent with THREAD_POOL which is already volatile.

Proposed fix: Add volatile to all affected fields.



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

Reply via email to