directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRSERVER-2155) Deleting a context entry then searching using the same value as a baseDn results in OPERATIONS_ERROR
Date Sun, 31 Jul 2016 05:47:20 GMT

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

Emmanuel Lecharny commented on DIRSERVER-2155:
----------------------------------------------

I finally had some time to check the issue. It's hard to reproduce in a unit test, sadly.
What seems to happen is that when the server has restarted, we try to update the context entry's
{{contextCSN}} value (this is useful for replication) but as the entry has been removed, it
does nit exist anymore.
The code that causes the NPE is probably (AbstractBtreePartition) :

{noformat}
    public void saveContextCsn() throws LdapException
    {
        if ( !ctxCsnChanged )
        {
            return;
        }
        
        String contextCsn = super.getContextCsn();
        
        if ( contextCsn == null )
        {
            return;
        }
        
        try
        {
            // we don't need to use the ctxCsnSemaphore here cause
            // the only other place this is called is from PartitionNexus.sync()
            // but that is protected by write lock in DefaultDirectoryService.shutdown()
            
            String contextEntryId = getEntryId( getSuffixDn() );
            Entry origEntry = fetch( contextEntryId );
            
            origEntry = ( ( ClonedServerEntry ) origEntry ).getOriginalEntry();   <-----
Here, origEntry is most certainly null.
            ...
{noformat}

Checking for origEntry nullity should solve the problem, IMO.

Here is the suggested modification :

{noformat}
    public void saveContextCsn() throws LdapException
    {
        if ( !ctxCsnChanged )
        {
            return;
        }
        
        String contextCsn = super.getContextCsn();
        
        if ( contextCsn == null )
        {
            return;
        }
        
        try
        {
            // we don't need to use the ctxCsnSemaphore here cause
            // the only other place this is called is from PartitionNexus.sync()
            // but that is protected by write lock in DefaultDirectoryService.shutdown()
            
            String contextEntryId = getEntryId( getSuffixDn() );
            Entry origEntry = fetch( contextEntryId );
            
            // The Context Entry may have been deleted. Get out if we don't find it
            if ( origEntry == null )
            {
                return;
            }
            origEntry = ( ( ClonedServerEntry ) origEntry ).getOriginalEntry();
...
{noformat}            


> Deleting a context entry then searching using the same value as a baseDn results in OPERATIONS_ERROR
> ----------------------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-2155
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2155
>             Project: Directory ApacheDS
>          Issue Type: Bug
>            Reporter: lucas theisen
>         Attachments: ads.zip
>
>
> If you have a context entry (perhaps dc=foo,dc=bar) that you delete, then issue a search
using that as the baseDn, you get an OPERATIONS_ERROR:
> {code}
> OPERATIONS_ERROR: failed for MessageType : SEARCH_REQUEST
> Message ID : 2
>     SearchRequest
>         baseDn : 'dc=foo,dc=bar'
>         filter : '(objectClass=*)'
>         scope : base object
>         typesOnly : false
>         Size Limit : no limit
>         Time Limit : no limit
>         Deref Aliases : deref Finding Base Obj
>         attributes : '*', '+'
> {code}
> Tuning up the debug gives this stack trace:
> {code}
> org.apache.directory.api.ldap.model.message.SearchRequestImpl@4fea602f: null:
> org.apache.directory.api.ldap.model.exception.LdapOperationErrorException
>         at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.search(AbstractBTreePartition.java:1132)
>         at org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.search(DefaultPartitionNexus.java:611)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor$1.search(BaseInterceptor.java:264)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.subtree.SubentryInterceptor.search(SubentryInterceptor.java:1568)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.collective.CollectiveAttributeInterceptor.search(CollectiveAttributeInterceptor.java:174)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.operational.OperationalAttributeInterceptor.search(OperationalAttributeInterceptor.java:437)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.schema.SchemaInterceptor.search(SchemaInterceptor.java:1273)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor.search(DefaultAuthorizationInterceptor.java:337)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.authz.AciAuthorizationInterceptor.search(AciAuthorizationInterceptor.java:1208)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.authn.AuthenticationInterceptor.search(AuthenticationInterceptor.java:1337)
>         at org.apache.directory.server.core.api.interceptor.BaseInterceptor.next(BaseInterceptor.java:677)
>         at org.apache.directory.server.core.normalization.NormalizationInterceptor.search(NormalizationInterceptor.java:304)
>         at org.apache.directory.server.core.DefaultOperationManager.search(DefaultOperationManager.java:1342)
>         at org.apache.directory.server.core.shared.DefaultCoreSession.search(DefaultCoreSession.java:1122)
>         at org.apache.directory.server.ldap.handlers.request.SearchRequestHandler.doSimpleSearch(SearchRequestHandler.java:827)
>         at org.apache.directory.server.ldap.handlers.request.SearchRequestHandler.handleIgnoringReferrals(SearchRequestHandler.java:1179)
>         at org.apache.directory.server.ldap.handlers.request.SearchRequestHandler.handleWithReferrals(SearchRequestHandler.java:1272)
>         at org.apache.directory.server.ldap.handlers.request.SearchRequestHandler.handle(SearchRequestHandler.java:223)
>         at org.apache.directory.server.ldap.handlers.request.SearchRequestHandler.handle(SearchRequestHandler.java:93)
>         at org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:207)
>         at org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:56)
>         at org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:221)
>         at org.apache.directory.server.ldap.LdapProtocolHandler.messageReceived(LdapProtocolHandler.java:217)
>         at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
>         at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
>         at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
>         at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
>         at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74)
>         at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
>         at org.apache.mina.filter.executor.UnorderedThreadPoolExecutor$Worker.runTask(UnorderedThreadPoolExecutor.java:475)
>         at org.apache.mina.filter.executor.UnorderedThreadPoolExecutor$Worker.run(UnorderedThreadPoolExecutor.java:429)
>         at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.directory.api.ldap.model.exception.LdapOperationErrorException
>         at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.saveContextCsn(AbstractBTreePartition.java:3362)
>         at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.search(AbstractBTreePartition.java:1128)
>         ... 38 more
> Caused by: java.lang.NullPointerException
>         at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.saveContextCsn(AbstractBTreePartition.java:3348)
>         ... 39 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message