[ 
https://issues.apache.org/jira/browse/SLING-11189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17502397#comment-17502397
 ] 

Stefan Seifert commented on SLING-11189:
----------------------------------------

the behavior i observe on windows 10 environment during sling startup:
* in the [activate 
method|https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/7b42e0e0f390e8cd29a9ba235e4e19808f011e7e/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java#L227]
 of BundleContentLoaderListener a list of all bundles is collected that are 
already there when this service starts up
* all those bundles are processed *before* any of the readers is registered 
(with false results if the content depend on those)
* then all readers are registered
* then all other bundles are processed which are started after the content 
loader, this time processing the content correctly with readers

we need somehow to create a dependency from BundleContentLoaderListener to 
ContentReaderWhiteboard to give the latter the opportunity detect and register 
all readers. at least those that come bundled with the sling content loader. we 
still have a problem if there are custom readers implemented in other bundles 
which load later, but this is not a use case we have to solve in this ticket.

alternatively, we could force a reload of all bundles' content once a new 
reader gets registered. this may lead to duplicate loading of this content, but 
would ensure it will also work for new readers registered later.

ideally, we have to combine those approaches - delay the first loading of 
bundle content until the built-in readers are available, and force a re-loading 
if new readers become available (what in practice will happen only rarely - so, 
let's fix the first issue first).

> Content Loader: Race condition registering readers vs. loading content
> ----------------------------------------------------------------------
>
>                 Key: SLING-11189
>                 URL: https://issues.apache.org/jira/browse/SLING-11189
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: JCR ContentLoader 2.5.0
>            Reporter: Stefan Seifert
>            Assignee: Stefan Seifert
>            Priority: Major
>
> in SLING-11168 we detected a specific problem with Composum in Sling Starter 
> 12, which only occured on Windows 10 environments (and even there not 
> consistently in every scenario).
> it seems that it may happen that Sling-Initial-Content is loaded from the 
> bundles when the ContentReader implementations are not yet registered on the 
> ContentReaderWhiteboard.
> when this happens, the content is loaded into the repository, but files like 
> *.json are not transformed to nodes and properties, but is stored as binary 
> json files in the repository.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to