You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Alex Parvulescu (JIRA)" <ji...@apache.org> on 2017/05/04 13:23:04 UTC

[jira] [Comment Edited] (OAK-6172) SecurityProviderImpl could cache the configuration set

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

Alex Parvulescu edited comment on OAK-6172 at 5/4/17 1:22 PM:
--------------------------------------------------------------

I've also noticed a race condition during the non-OSGi setup where all the configs call {{SecurityProviderImpl#getConfigurations}} before the set is initialised, so I'm not sure what this turns into.
ie: {{SecurityProviderImpl}} sets up a new {{AuthenticationConfigurationImpl}} that calls {{SecurityProviderImpl#getConfigurations}} before the set had a chance to properly setup, probably getting back only the default config (empty even?)
Relevant trace:
{noformat}
at org.apache.jackrabbit.oak.security.SecurityProviderImpl.getConfigurations(SecurityProviderImpl.java:137)
at org.apache.jackrabbit.oak.security.SecurityProviderImpl.getParameters(SecurityProviderImpl.java:126)
at org.apache.jackrabbit.oak.security.authentication.AuthenticationConfigurationImpl.<init>(AuthenticationConfigurationImpl.java:87)
at org.apache.jackrabbit.oak.security.SecurityProviderImpl.<init>(SecurityProviderImpl.java:100)
at org.apache.jackrabbit.oak.benchmark.authentication.external.AbstractExternalTest$TestSecurityProvider.<init>(AbstractExternalTest.java:241)
{noformat}


was (Author: alex.parvulescu):
I've also noticed a race condition during the non-OSGi setup where all the configs call {{SecurityProviderImpl#getConfigurations}} before the set is initialised, so I'm not sure what this turns into.
ie: {{SecurityProviderImpl}} sets up a new {{AuthenticationConfigurationImpl}} that calls {{SecurityProviderImpl#getConfigurations}} before the set had a chance to properly setup, probably getting back only the default config (empty even?)
{noformat}
	at org.apache.jackrabbit.oak.security.SecurityProviderImpl.getConfigurations(SecurityProviderImpl.java:137)
	at org.apache.jackrabbit.oak.security.SecurityProviderImpl.getParameters(SecurityProviderImpl.java:126)
	at org.apache.jackrabbit.oak.security.authentication.AuthenticationConfigurationImpl.<init>(AuthenticationConfigurationImpl.java:87)
	at org.apache.jackrabbit.oak.security.SecurityProviderImpl.<init>(SecurityProviderImpl.java:100)
	at org.apache.jackrabbit.oak.benchmark.authentication.external.AbstractExternalTest$TestSecurityProvider.<init>(AbstractExternalTest.java:241)
{noformat}

> SecurityProviderImpl could cache the configuration set
> ------------------------------------------------------
>
>                 Key: OAK-6172
>                 URL: https://issues.apache.org/jira/browse/OAK-6172
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core, security
>            Reporter: Alex Parvulescu
>
> This is about the {{SecurityProviderImpl#getConfigurations}} [0] method.
> This seems to be called for each commit [1], and for the {{AddMembersTest}} benchmark can take as much as 10% of the duration [1].
> I propose to cache this set during init and reuse it. tested this against the benchmark and got the following:
> * eager config
> {noformat}
> # AddMembersTest                   C     min     10%     50%     90%     max       N 
> Oak-Segment-Tar                    1       3       3       4       4     311   11271
> {noformat}
> * lazy config
> {noformat}
> # AddMembersTest                   C     min     10%     50%     90%     max       N 
> Oak-Segment-Tar                    1       3       3       4       4     374   10842
> {noformat}
> [0] https://github.com/apache/jackrabbit-oak/blob/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java#L134
> [1]
> {noformat}
> at java.util.HashSet.add(HashSet.java:219)
> at org.apache.jackrabbit.oak.security.SecurityProviderImpl.getConfigurations(SecurityProviderImpl.java:136)
> at org.apache.jackrabbit.oak.core.MutableRoot.getCommitHook(MutableRoot.java:276)
> at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)
> at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)
> at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)
> at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)
> at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)
> at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)
> at org.apache.jackrabbit.oak.benchmark.AddMembersTest.addMembers(AddMembersTest.java:188)
> at org.apache.jackrabbit.oak.benchmark.AddMembersTest.runTest(AddMembersTest.java:173)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)