Uploaded image for project: 'Directory Client API'
  1. Directory Client API
  2. DIRAPI-342

Unbind breaks connection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0.AM2
    • 2.0.0
    • None

    Description

      The DelegatedAuthIT/DelegatedAuthOverSslIT/DelegatedAuthOverTlsIT tests fail randomly (I try to stabilize tests on Windows, but also happens on Jenkins). They all do multiple bind() and unbind() on the same connection, it seems the unbind() is the reason.

      A simple test to reproduce the problem (on Linux):

          @Test
          public void testSimpleBindAndUnbindLoop() throws Exception
          {
              try ( LdapConnection connection = new LdapNetworkConnection( Network.LOOPBACK_HOSTNAME,
                  getLdapServer().getPort() ) )
              {
                  for ( int i = 0; i < 10000; i++ )
                  {
                      System.out.println( i );
                      connection.bind( "uid=admin,ou=system", "secret" );
                      assertTrue( connection.isAuthenticated() );
                      connection.unBind();
                      assertFalse( connection.isAuthenticated() );
                      // Thread.sleep( 10L );
                  }
              }
          }
      

      Without the unbind() or when sleeping for 10ms it works fine.

      Otherwise I saw 3 different errors:

      org.apache.directory.ldap.client.api.exception.InvalidConnectionException: ERR_04108_INVALID_CONNECTION Cannot connect on the server, the connection is invalid
      	at org.apache.directory.ldap.client.api.LdapNetworkConnection.checkSession(LdapNetworkConnection.java:574)
      	at org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1596)
      	at org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1488)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:134)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:118)
      
      org.apache.directory.api.ldap.model.exception.LdapException: ERR_04169_RESPONSE_QUEUE_EMPTIED The response queue has been emptied, no response was found.
      	at org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1534)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:134)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:118)
      Caused by: org.apache.directory.api.ldap.model.exception.LdapException: ERR_04170_TIMEOUT_OCCURED TimeOut occurred
      	at org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1505)
      
      org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException: PROTOCOL_ERROR: The server will disconnect!
      	at org.apache.directory.api.ldap.model.message.ResultCodeEnum.processResponse(ResultCodeEnum.java:2137)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:136)
      	at org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:118)
      	at org.apache.directory.shared.client.api.operations.bind.SimpleBindRequestTest.testSimpleBindAndUnbindLoop(SimpleBindRequestTest.java:664)
      

      Attachments

        1. latch.patch
          2 kB
          Emmanuel Lécharny

        Activity

          People

            Unassigned Unassigned
            seelmann Stefan Seelmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: