Martin Schulze created SLING-11317:
--------------------------------------
Summary: Rewriter configuration gets "lost" in
ProcessorManagerImpl when package with another configuration gets deployed
Key: SLING-11317
URL: https://issues.apache.org/jira/browse/SLING-11317
Project: Sling
Issue Type: Bug
Reporter: Martin Schulze
On our AEM 6.5 instance (org.apache.sling.rewriter-1.2.2, but nothing major
happened with this class since this version) we have multiple rewriter
configurations and sometimes after a deployment of another package with a
rewriter configuration, a configurations is not triggered anymore and the
instance has to be restarted to get it working again. I've tracked the issue
down and found the issue lies in the {{ProcessorManagerImpl}} [0]. There are
two fields, {{processors}} and {{orderedProcessor}}, which are supposed to be
mostly (inactive configs are not in the {{orderedProcessors}}) "in sync", which
is important because later on there is an {{updateProcessor}} method [2], where
the updated config has to be found in the {{processors}} field, but they
diverge from the start, in the addProcessor [1] method, the added config never
reaches the {{processors}} field, because the newConfigs local variable never
gets added to the processors field. This lead to the issue, that in the
updateProcessor method, which gets triggered through the
ResourceChangeListener, a configuration gets wrongfully deleted [3].
[0]
https://github.com/apache/sling-org-apache-sling-rewriter/blob/master/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java
[1]
https://github.com/apache/sling-org-apache-sling-rewriter/blob/master/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java#L240
[2]
https://github.com/apache/sling-org-apache-sling-rewriter/blob/master/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java#L299
[3]
https://github.com/apache/sling-org-apache-sling-rewriter/blob/master/src/main/java/org/apache/sling/rewriter/impl/ProcessorManagerImpl.java#L378
--
This message was sent by Atlassian Jira
(v8.20.7#820007)