Abhishek Garg created SLING-13434:
-------------------------------------

             Summary: NoClusterDiscoveryService can retain stale properties 
after interleaved PropertyProvider updates
                 Key: SLING-13434
                 URL: https://issues.apache.org/jira/browse/SLING-13434
             Project: Sling
          Issue Type: Bug
            Reporter: Abhishek Garg


*Summary*
A deterministic unit test reproduces stale topology properties after two 
PropertyProvider update callbacks interleave. This identifies a failure path in 
Discovery Standalone; whether it caused the Helvetia incident remains 
unverified.
h2. Reproduction

{{updatedPropertyProvider}} calls {{unbindPropertyProvider(..., false)}} and 
then {{bindPropertyProvider(...)}} in separate synchronized sections. If two 
update callbacks interleave between those operations, the provider list can 
contain duplicate entries with the same service ID.

{{ProviderInfo}} snapshots properties when constructed, but equality is based 
on service ID. A later update can remove the newer duplicate while the older 
snapshot remains last; {{updatePropertiesCache()}} then preserves the stale 
value.

The test simulates that interleaving, changes the provider value from 
{{test/early}} to {{{}test/early,test/late{}}}, and verifies the topology 
property. Actual: {{{}test/early{}}}. Expected: {{{}test/early,test/late{}}}.
h2. Verification
 * {{mvn -Dtest=InterleavedPropertyProviderUpdateTest test}} — fails with the 
stale value, as expected.
 * {{mvn -Dtest=NoClusterDiscoveryServiceTest test}} — passes (6 tests).
 * {{mvn -DskipTests verify}} — passes.

The test deterministically models callback interleaving; it does not force 
concurrent OSGi/SCR threads or prove this was the production cause.
h2. Related PR

Draft test-only PR: 
[https://github.com/apache/sling-org-apache-sling-discovery-standalone/pull/3]



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

Reply via email to