Hi Lucas,

Read the LDAP RFC. That’s what is says about Unbind:

The function of the Unbind operation is to terminate an LDAP session.
   The Unbind operation is not the antithesis of the Bind operation as
   the name implies.  The naming of these operations are historical.
   The Unbind operation should be thought of as the "quit" operation.

Regards,

Ludovic
-- 
Ludovic Poitou
Product Manager for OpenDJ, the LDAP open source directory services : 
http://opendj.forgerock.org
ForgeRock - http://ForgeRock.com
http://ludopoitou.wordpress.com

On 25 Jul 2014 at 00:24:36, Theisen, Lucas ([email protected]) wrote:

Hi,

 

I am running into some sort of race condition when calling unBind().  I am not 
sure exactly why but this simple test case demonstrates the issue:

    @Test

    publicvoid testRebind() throws Exception

    {

        LdapConnection connection = pool.getConnection();

        try

        {

            for ( int i = 0; i < 1000; i++ ) {

                    connection.unBind();

                    connection.bind(

                        ServerDNConstants.ADMIN_SYSTEM_DN,

                        "secret" );

            }

        }

        finally

        {

            assertNotNull( connection );

            pool.releaseConnection( connection );

        }

    }

 

It will fail at some point in the loop (usually around 100, but I have seen 10 
or even 350).  The exception is usually:

 

java.lang.IllegalStateException: The connector has been disposed.

                at 
org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:195)

                at 
org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:171)

                at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.connect(LdapNetworkConnection.java:538)

                at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bindAsync(LdapNetworkConnection.java:1195)

                at 
org.apache.directory.ldap.client.api.LdapNetworkConnection.bind(LdapNetworkConnection.java:1115)

                at 
org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:127)

                at 
org.apache.directory.ldap.client.api.AbstractLdapConnection.bind(AbstractLdapConnection.java:112)

                at 
org.apache.directory.shared.client.api.LdapConnectionPoolTest.testRebind(LdapConnectionPoolTest.java:168)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:606)

                at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)

                at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

                at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)

                at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

                at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

                at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)

                at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)

                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)

                at 
org.apache.directory.server.core.integ.FrameworkRunner.runChild(FrameworkRunner.java:379)

                at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)

                at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)

                at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)

                at 
org.junit.runnrs.ParentRunner.access$000(ParentRunner.java:53)

                at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:309)

                at 
org.apache.directory.server.core.integ.FrameworkRunner.run(FrameworkRunner.java:154)

                at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

 

Though it occasionally fails with a NullPointerException on the connector 
object inside of bind() method at connector.connect().  In my opinion, this is 
clearly a bug, but wanted input before filing it.  Does anybody have any info 
that may pertain?  Also, I notice that unBind() actually closes the session.  
Why is this?  It seems like that is a bad idea as I don’t see any way to 
unBind() and keep the session live.  Does anybody know if there is a good 
reason why unBind() closes the session?  Any argument against overloading 
unBind() to take an boolean to closeSession?

 

Thank You,

Lucas Theisen

[email protected]

 

Reply via email to