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

Julian Sedding commented on SLING-7811:
---------------------------------------

Sorry for the delayed response. [~rombert] the commits regarding robustness 
definitely look good!

I remember making startup async when I added the whitelist fragment feature, 
but I also remember that I had noticed at the time that the 
RepositoryInitializer instances *never* ran before the repo was published - 
which IIRC was the intention when they were introduced. The details evade me, 
but the async startup improved that situation.

For this issue, which is essentially an optimization of the startup sequence 
IIUC, there are multiple aspects:
 - restarting and/or reinitializing the {{SlingRepository}} should be graceful
 - {{SecurityProviderRegistration}} causes the {{SecurityProvider}} to "bounce"

In order to get the better startup experience, I think we would need to prevent 
the {{SecurityProvider}} from bouncing. In order to do that, I see the 
following options:
# set target filters for references on {{SecurityProviderRegistration}} to 
prevent it binding to undesired services that later are dynamically exchanged - 
if this is done via configuration, the lack of config policy REQUIRED on 
{{SecurityProviderRegistration}} could lead to further timing issues and thus 
bouncing
# provide a fully dynamic {{SecurityProvider}}, which is not unregistered due 
to changing references (this might be a refactoring of 
{{SecurityProviderRegistration}} into a {{DynamicDelegatingSecurityProvider}}
# let {{SecurityProviderRegistration}} register {{SecurityProvider}} with 
service properties that advertise which service implementations it is using 
(e.g. 
authorizableActionProvider=org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthorizableActionProvider).
 Then the {{*SlingRepositoryManager}} could require configuration and bind to 
the {{SecurityProvider}} only once it is using the correct services under the 
hood (this is somewhat similar to 1.)

All of the above need changes in Oak, however.

> NPE when repository is starting up due to repository manager shutdown
> ---------------------------------------------------------------------
>
>                 Key: SLING-7811
>                 URL: https://issues.apache.org/jira/browse/SLING-7811
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR Oak Server 1.1.4, JCR Base 3.0.4
>            Reporter: Carsten Ziegeler
>            Assignee: Robert Munteanu
>            Priority: Major
>             Fix For: JCR Base 3.0.6, JCR Oak Server 1.2.2
>
>
> With the latest Sling Starter, the following NPE occurs in the logs. It seems 
> to be harmless, nevertheless we should fix it:
> For now I assigned it to both, JCR Base and Oak Server, as it's unclear which 
> one it is. Interestingly we've released Oak Server 1.2.0 but are not using it 
> in the starter.
> {noformat}
> 06.08.2018 15:45:18.396 *ERROR* [Apache Sling Repository Startup Thread] 
> org.apache.sling.jcr.oak.server.internal.OakSlingRepositoryManager start: 
> Uncaught Throwable trying to access Repository, calling stopRepository()
> java.lang.NullPointerException: null
>         at 
> com.google.common.base.Preconditions.checkNotNull(Preconditions.java:192) 
> [com.google.guava:15.0.0]
>         at org.apache.jackrabbit.oak.jcr.Jcr.with(Jcr.java:296) 
> [org.apache.jackrabbit.oak-jcr:1.6.8]
>         at 
> org.apache.sling.jcr.oak.server.internal.OakSlingRepositoryManager.acquireRepository(OakSlingRepositoryManager.java:161)
>  [org.apache.sling.jcr.oak.server:1.1.4]
>         at 
> org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:471)
>  [org.apache.sling.jcr.base:3.0.4]
>         at 
> org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:85)
>  [org.apache.sling.jcr.base:3.0.4]
>         at 
> org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlingRepositoryManager.java:455)
>  [org.apache.sling.jcr.base:3.0.4]
> {noformat}
> The stack trace points to a null workspace name ( see 
> https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.8/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java#L296
>  ).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to