Directory ApacheDS
  1. Directory ApacheDS
  2. DIRSERVER-935

Test hangs on non-existant schema entry lookup

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.5.6
    • Component/s: ldap
    • Labels:
      None

      Description

      Hey Guys,

      I do a lookup like this inside a test:
      syntaxContext.lookup(xsdSyntaxStringRDN);
      // syntaxContext.lookup("monkeywrench");

      If I leave the monkeywrench lookup commented
      out, the test runs fine repeatedly.

      If I comment in the monkeywrench the
      test just hangs. I was expecting
      a NamingException.

      I pasted a self contained test for this
      below.

      Cheers,

      • Ole

        Activity

        Emmanuel Lecharny made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Kiran Ayyagari made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Kiran Ayyagari added a comment -

        Looks like the issue no longer exists (I ran the test case against the trunk and couldn't reproduce the issue)

        Show
        Kiran Ayyagari added a comment - Looks like the issue no longer exists (I ran the test case against the trunk and couldn't reproduce the issue)
        Emmanuel Lecharny made changes -
        Fix Version/s 1.5.6 [ 12314538 ]
        Fix Version/s 2.0.0 [ 12312396 ]
        Hide
        Emmanuel Lecharny added a comment -

        Let's get rid of this issue in 1.5.6

        Show
        Emmanuel Lecharny added a comment - Let's get rid of this issue in 1.5.6
        Hide
        Ole Ersoy added a comment -

        OK - I'm picking backing on this bug,
        since this observation uses the same test code,
        although this is likely a different bug.

        If I add
        attributes.put( "m-name", "hello" );

        to the attributes of the syntax entry,
        and try to run the test again, I get:

        javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - failed to add entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233,ou=syntaxes,cn=xsd,ou=schema: Attribute m-name not declared in objectClasses of entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233,ou=syntaxes,cn=xsd,ou=schema]; remaining name 'm-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233'
        at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3036)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2951)
        at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2758)
        at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:774)

        Even though the the ObjectClasses that the syntax entry uses
        are the same as the ObjectClasses on other syntax entries that have
        the m-name attribute.

        Show
        Ole Ersoy added a comment - OK - I'm picking backing on this bug, since this observation uses the same test code, although this is likely a different bug. If I add attributes.put( "m-name", "hello" ); to the attributes of the syntax entry, and try to run the test again, I get: javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - failed to add entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233,ou=syntaxes,cn=xsd,ou=schema: Attribute m-name not declared in objectClasses of entry m-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233,ou=syntaxes,cn=xsd,ou=schema] ; remaining name 'm-oid=1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3036) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2951) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2758) at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:774) Even though the the ObjectClasses that the syntax entry uses are the same as the ObjectClasses on other syntax entries that have the m-name attribute.
        Hide
        Stefan Zoerner added a comment -

        Problem reproducible in my environment. Server logs an exception, but the connections to the client is still open, and probably no response is sent to the client due to this error ...

        [19:26:09] ERROR [org.apache.directory.shared.ldap.codec.LdapMessageGrammar] - Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid : Bad DN : monkeywrench,ou=syntaxes,cn=xsd,ou=schema
        [19:26:09] ERROR [org.apache.directory.shared.ldap.codec.LdapMessageGrammar] - Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid : Bad DN : monkeywrench,ou=syntaxes,cn=xsd,ou=schema
        [19:26:09] INFO [org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler] - [/127.0.0.1:4349] CLOSED
        [19:26:09] INFO [org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler] - [/127.0.0.1:4349] EXCEPTION:
        org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.directory.shared.ldap.message.ResponseCarryingMessageException: Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid (Hexdump: 30 06 02 01 07 50 01 06)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:174)
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:243)
        at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:305)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Unknown Source)
        Caused by: org.apache.directory.shared.ldap.message.ResponseCarryingMessageException: Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid
        at org.apache.directory.shared.ldap.message.MessageDecoder.decode(MessageDecoder.java:226)
        at org.apache.directory.shared.asn1.codec.Asn1CodecDecoder.decode(Asn1CodecDecoder.java:53)
        at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:163)
        ... 8 more

        Show
        Stefan Zoerner added a comment - Problem reproducible in my environment. Server logs an exception, but the connections to the client is still open, and probably no response is sent to the client due to this error ... [19:26:09] ERROR [org.apache.directory.shared.ldap.codec.LdapMessageGrammar] - Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid : Bad DN : monkeywrench,ou=syntaxes,cn=xsd,ou=schema [19:26:09] ERROR [org.apache.directory.shared.ldap.codec.LdapMessageGrammar] - Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid : Bad DN : monkeywrench,ou=syntaxes,cn=xsd,ou=schema [19:26:09] INFO [org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler] - [/127.0.0.1:4349] CLOSED [19:26:09] INFO [org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler] - [/127.0.0.1:4349] EXCEPTION: org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.directory.shared.ldap.message.ResponseCarryingMessageException: Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid (Hexdump: 30 06 02 01 07 50 01 06) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:174) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362) at org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:243) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:305) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.directory.shared.ldap.message.ResponseCarryingMessageException: Invalid root DN given : monkeywrench,ou=syntaxes,cn=xsd,ou=schema (0x6D 0x6F 0x6E 0x6B 0x65 0x79 0x77 0x72 0x65 0x6E 0x63 0x68 0x2C 0x6F 0x75 0x3D 0x73 0x79 0x6E 0x74 0x61 0x78 0x65 0x73 0x2C 0x63 0x6E 0x3D 0x78 0x73 0x64 0x2C 0x6F 0x75 0x3D 0x73 0x63 0x68 0x65 0x6D 0x61 ) is invalid at org.apache.directory.shared.ldap.message.MessageDecoder.decode(MessageDecoder.java:226) at org.apache.directory.shared.asn1.codec.Asn1CodecDecoder.decode(Asn1CodecDecoder.java:53) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:163) ... 8 more
        Stefan Zoerner made changes -
        Description Hey Guys,

        I do a lookup like this inside a test:
                syntaxContext.lookup(xsdSyntaxStringRDN);
        // syntaxContext.lookup("monkeywrench");

        If I leave the monkeywrench lookup commented
        out, the test runs fine repeatedly.

        If I comment in the monkeywrench the
        test just hangs. I was expecting
        a NamingException.

        I pasted a self contained test for this
        below.

        Cheers,
        - Ole


        package org.apache.tuscany.das.ldap.create.test;

        import java.util.Hashtable;

        import javax.naming.NamingException;
        import javax.naming.directory.Attribute;
        import javax.naming.directory.Attributes;
        import javax.naming.directory.BasicAttribute;
        import javax.naming.directory.BasicAttributes;
        import javax.naming.directory.DirContext;
        import javax.naming.directory.InitialDirContext;

        import junit.framework.TestCase;

        public class CreateSyntaxEntrySelfContainedTest extends TestCase
        {
            private static final String XSD_CONTEXT_RDN = "cn=xsd";
            private static final String XSD_SYNTAX_RDN = "ou=syntaxes";
            private static final String OID = "1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233";

            private DirContext directoryContext = null;
            private DirContext xsdContext = null;
            private DirContext syntaxContext = null;
            private String xsdSyntaxStringRDN = "m-oid" + "=" + OID;


            public void setUp() throws NamingException
            {
                directoryContext = connect();
                xsdContext = createXSDSchemaContext();
                syntaxContext = createSyntaxContext();
            }

            public void tearDown() throws NamingException
            {
                syntaxContext.destroySubcontext( xsdSyntaxStringRDN );
                syntaxContext.close();
                xsdContext.destroySubcontext( XSD_SYNTAX_RDN );
                xsdContext.close();
                directoryContext.destroySubcontext( XSD_CONTEXT_RDN );
                directoryContext.close();
            }

            public DirContext connect() throws NamingException
            {
                        Hashtable<String,String> env = new Hashtable<String, String>();

                        env.put(
                            DirContext.INITIAL_CONTEXT_FACTORY,
                            "com.sun.jndi.ldap.LdapCtxFactory" );
                        env.put(
                            DirContext.PROVIDER_URL,
                            "ldap://localhost:10389/ou=schema");
                        env.put(
                            DirContext.SECURITY_AUTHENTICATION,
                            "simple");
                        env.put(
                            DirContext.SECURITY_PRINCIPAL,
                            "uid=admin,ou=system" );
                        env.put(
                            DirContext.SECURITY_CREDENTIALS,
                           "secret" );
                        return new InitialDirContext(env);
            }

            public DirContext createXSDSchemaContext() throws NamingException
            {
                Attributes xsdAttributes = new BasicAttributes();

                Attribute topAttribute = new BasicAttribute(
                    "objectClass",
                    "top");

                Attribute metaSchemaAttribute = new BasicAttribute(
                    "objectClass",
                    "metaSchema");

                Attribute xsdAttribute = new BasicAttribute(
                    "cn",
                    "xsd");

                Attribute mDependenciesAttribute = new BasicAttribute(
                    "m-dependencies", "system");

                xsdAttributes.put( xsdAttribute );
                xsdAttributes.put( topAttribute );
                xsdAttributes.put( metaSchemaAttribute );
                xsdAttributes.put( mDependenciesAttribute );

                return directoryContext.createSubcontext(
                    XSD_CONTEXT_RDN, xsdAttributes );
            }


            public DirContext createSyntaxContext() throws NamingException
            {
                Attribute syntaxesAttribute = new BasicAttribute(
                    "ou", "syntaxes");

                Attribute organizationUnitAttribute = new BasicAttribute(
                    "objectClass", "organizationalUnit");

                Attribute topAttribute = new BasicAttribute(
                    "objectClass",
                    "top");

                Attribute metaSchemaAttribute = new BasicAttribute(
                    "objectClass",
                    "metaSchema");

                Attributes syntaxAttributes = new BasicAttributes();
                syntaxAttributes.put( syntaxesAttribute );
                syntaxAttributes.put( topAttribute );
                syntaxAttributes.put( metaSchemaAttribute );
                syntaxAttributes.put( organizationUnitAttribute);

                return ( DirContext ) xsdContext.createSubcontext( XSD_SYNTAX_RDN, syntaxAttributes );
            }

            public void testCreateSyntaxSchemaEntry() throws NamingException
            {
                Attribute objectClassAttribute = new BasicAttribute(
                    "objectClass",
                    "top" );

                objectClassAttribute.add( "metaTop" );
                objectClassAttribute.add( "metaSyntax" );

                Attribute oidAttribute = new BasicAttribute(
                    "m-oid",
                    OID);

                Attribute descriptionAttribute = new BasicAttribute(
                    "m-description",
                    "xsd:String");

                Attributes attributes = new BasicAttributes();

                attributes.put( objectClassAttribute );
                attributes.put( oidAttribute );
                attributes.put( descriptionAttribute );

                syntaxContext.createSubcontext( xsdSyntaxStringRDN, attributes );
                syntaxContext.lookup(xsdSyntaxStringRDN);
        // syntaxContext.lookup("monkeywrench");
            }
        }
        Hey Guys,

        I do a lookup like this inside a test:
                syntaxContext.lookup(xsdSyntaxStringRDN);
        // syntaxContext.lookup("monkeywrench");

        If I leave the monkeywrench lookup commented
        out, the test runs fine repeatedly.

        If I comment in the monkeywrench the
        test just hangs. I was expecting
        a NamingException.

        I pasted a self contained test for this
        below.

        Cheers,
        - Ole
        Hide
        Stefan Zoerner added a comment -

        Source code now attached thanks to Ole.

        Show
        Stefan Zoerner added a comment - Source code now attached thanks to Ole.
        Ole Ersoy made changes -
        Field Original Value New Value
        Attachment CreateSyntaxEntrySelfContainedTest.java [ 12357556 ]
        Ole Ersoy created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Ole Ersoy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development