[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-06-03 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16854606#comment-16854606
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

FTR there is another big issue in this class: doing a {{connect()}} is not 
safe, as we don't wait for the connection to be established fully. Actually, we 
should use the same mechanism than for the connection closure: wait for the 
{{sessionCreated()}} to be called before considering the connection 
established, and we don't do that.
The whole class does not properly leverage the asynchronous aspect of MINA 
correctly, and that has to be fixed. At the end:
* a connection should be considered as connected when the {{sessionCreated}} 
event has been processed
* a connection should be considered as closed when the {{sessionClosed}} event 
has been processed
Any other way is going to cause issues...

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org



[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-06-02 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853987#comment-16853987
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

There is some more work to do. Typically, when doing a {{bind}}, it may fail, 
and in this case, we should be sure we close the connection in a proper way.

FTR, I'm using a {{CountdownLatch}} with a value of {{1}} when disconnecting, 
and I decrement this counter when the disconnection is completed or aborted. 
This can be done in the {{sessionClosed()}, or it should be done 'manually' 
whenever we get an exception (typically, when trying to establish a TLS 
connection, we might have a timeout and never call {{sessionClosed()}}.

All in all, it's messy and has to be carefully checked, with all the 'i' dotted 
and 't' crossed...

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@directory.apache.org
For additional commands, e-mail: dev-h...@directory.apache.org



[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-06-01 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853830#comment-16853830
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

All server tests passing green now.

Time for a review first, then a merge with Stefan's patch. 

If all is ok, I'll create a branch.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-06-01 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853676#comment-16853676
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

AFAICT, there are valuable things in your previous commit. I'll probably merge 
the two.

ATM, I'm fighting with exceptions that cause the connection to stall (because 
it's waiting for the {{closedSession}} event that is never called).

Making progress though.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-06-01 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853604#comment-16853604
 ] 

Stefan Seelmann commented on DIRAPI-342:


Ok. And feel free to revert my previous change :)

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-31 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16853449#comment-16853449
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

FTR, I'm working on a better patch, with a cleaned up {{unbind()}} method 
without all the code duplication we have with the {{sessionClosed()}} method. 
The logic will be that cleaning up a session will be done once and for all in 
the {{sessionClosed()}} method.

That will also require some fix in the {{bindAsync( SaslGssApiRequest request 
)}} method, as an exception can be caught and rethrown without closing the 
session.

Last, not least, the patch in progress will break the {{PasswordPolicy}} unit 
test as the {{checkBindSuccess}} and {{checkBindFailure}} methods are not 
correctly used (we create a user connection before calling them, and they 
create a second connection. Pretty lame !

More to come...

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-31 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16852720#comment-16852720
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Note: this patch is *very* minimalist. It's more a proof of concept than 
anything else.

There is much more to do, and typically, stop trying to clean up the session in 
any place but the {{sessionClosed()}} method.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-30 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16852664#comment-16852664
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

I have created a patch to make the {{unbind}} operation blocking (ie it waits 
for the session to be really closed before returning).

The idea is to wait for the {{sessionClosed}} event to be called while in the 
{{unbind}} method. That should work. We need to do the same thing in the 
{{close}} method.

Note: I have created this patch on a version before your last commit, Stefan.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
> Attachments: latch.patch
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-29 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16851225#comment-16851225
 ] 

Stefan Seelmann commented on DIRAPI-342:


Ok, I see. I'll give it a try.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-27 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16849012#comment-16849012
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

What about that:
- no matter what, a call to {{unbind}} or {{close}} should put the session in a 
state where no other operation can be executed, as if the session was 
immediately closed.
- which means we have to wait either for the {{inputClosed}} event or for the 
session cleanup (it all depends on which ends first)

(that's just rephrasing the previous comment)

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-27 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848681#comment-16848681
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

That's nasty...

When you call {{unbind}}, two things happen:
- once the server has processed the request, it will close the TCP connection. 
On the client, it will generate a {{inputClosed}} event, which calls 
{{session.closeNow()}}
- OTOH, when a {{Unbind}} request is sent, a {{Future}} is created, with a 
{{ready}} flag that is set to {{false}} until the message has been fully 
written. It should be done immediately (but not necessarily), and in this case, 
the {{ready}} flag is set to true, so the {{Future}} will not block. Now, the 
message  map is cleared, and {{close()}} is called.

whatever wins will lead to the result: the session will be closed, but the way 
it does it is not the same.
2) if the first course of action wins, we end with {{closeNow()}} being called, 
which will be processed later on in a separate thread.
1) if the second course of action wins, the {{sessionClosed()}} method is 
called which should shutdown the client, clear the map, etc, but *inanother 
thread* (ie, the client might be able to process some new operation before the 
session is really closed)

Anyway, we have a potential short period of time where we *may* be able  to 
reuse a session that is not clean.

Waiting for the {{closeFuture}} does not help. We need to wait on something 
that guarantees the session has been closed, a {{Future}} set in the 
{{sessionClosed}} event. Until this future is set, we should *not* reuse the 
session. It should be created before we write the {{Unbind}} request, or before 
we call {{close()}}, and it should be waiting for when one try to {{connect()}} 
or to send any message.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException: 
> PROTOCOL_ERROR: The server will disconnect!
>   at 
> 

[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-26 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848623#comment-16848623
 ] 

Stefan Seelmann commented on DIRAPI-342:


Can't we make unbind()/close() blocking until really closed? There are no async 
methods anyways for close and unbind. I tried to wait for the close future 
returned by ldapSession.closeNow() but that doesn't work, the callbacks are 
called later, but I didn't dig into Mina.

I committed my changes btw:
* 
https://github.com/apache/directory-ldap-api/commit/125889b6e094be7659f9f448027e79029dcfa890
* 
https://github.com/apache/directory-server/commit/e77e2b0a6e0de83b90db0c07999c410660821ec2



> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-26 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848565#comment-16848565
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Thanks Stefan, 

you clearly  have a point.

>From what I can see, the big problem is when we call {{close()}}, we don't set 
>the session in a state where we can't reconnect until the future map is 
>cleaned: we just expect it will be done during the {{sessionClosed()}} event 
>processing, which might be differed.

Now, I wonder if it wouldn't be a better solution to check if the session is in 
{{closing}} state when we try to connect again (we don't check this status 
currently). Typically, we should probably check the {{closeFuture}} returned by 
the call to {{ldapSession.closeNow()}} in {{close()}} when we try a connect 
(which means this closeFuture}} *MUST* be stored globally in the connection.


This would be something like :
- when closing the connection, store the {{closeFuture}} in the connection
- when doing a connect, check if there is a {{closeFuture}} and if so, wait on 
it
- clean up the session when the {{sessionClosed()}} event is finally received

wdyt ?

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-26 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16848536#comment-16848536
 ] 

Stefan Seelmann commented on DIRAPI-342:


I found 2 race conditions:
* The sessionClosed() callback is called asynchronously by Mina when the 
connection is closed. When that call is a bit delayed and done when the new 
connection is already established and other operations (bind, search, etc) 
executed it closes that new connection.
* Similar the close listener (in setCloseListener()) is also called 
asynchronously by Mina when the connection is closed. When that call is delayed 
it will remove messages from the futureMap and issue a protocol error.

I changed both to check if the sessions are the same. The methods are now 
synchronized because otherwise access to member variables is not deterministic.

I'd not be surprised when there are more race conditions, the class is huge and 
has mutating state and has many callbacks.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM4, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-09 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16836200#comment-16836200
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Also you can see that the test is running fine in jenkins 
(https://builds.apache.org/view/D/view/Directory/job/dir-server-pipeline/57/)

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-08 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16836102#comment-16836102
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Did a test on linux in a VM, it works perfectly fine with 100 000 loops (it 
took 131s, so 763 connect/bind/unbind/disconnect per second). I have unlimited 
ulimit, but it only takes 14 000 FDs.

I suggest you augment the ulimit value.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-08 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835535#comment-16835535
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Ok, so any closed socket will stay in {{TIME_WAIT}} for 60 seconds - which is 
ok - and you will be able to create 1000 file descriptors - which is quite low 
-.

The {{SO_LINGER}} parameter is of little use. It will just make it so that a 
socket can be closed brutally. On the server, it's more important to set the 
{{SO_REUSEADDR}} flag which allows thee reuse of sockets.

But bottom line, when you run the loop, it takes something like 3ms to 
establish a connection, bind and unbind, which means you can only loop 18 000 
times with the {{TIME_WAIT}} set to 60 seconds (60 * 1/0.003), and you will 
exhaust your file descriptors in less than that, simply because many are 
already in use when you start the test (I typically have 800 FD used on my 
laptop). One way to check teh FD exhaustion is to periodically run {{netstat 
-na | wc -l}}.

There is nothing you can do about sockets waiting in {{TIME_WAIT}} state (see 
https://dvas0004.files.wordpress.com/2010/07/state_diag.png), the socket will 
wait 2 times the configured MSL, no matter what. The only way to augment the 
number of sockets you can open is to change the {{ulimit}} parameter.

Side note: it's clearly not recommanded to change the MSL parameter on a 
machine, that would impact *all* the applications. Changing the ulimit though 
can be done either for the system or for the user running the tests (although 
there are two existing limits, the OS limit blocks the user limits).

The question is why adding a 2ms sleep helps. Note that sleep(2) will not 
necessarily wait 2ms.

I will install a linux VLM to do some more tests.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> org.apache.directory.api.ldap.model.exception.LdapProtocolErrorException: 
> PROTOCOL_ERROR: The server will disconnect!
>   at 
> 

[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-08 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835436#comment-16835436
 ] 

Stefan Seelmann commented on DIRAPI-342:


{code}
$ cat /proc/sys/net/ipv4/tcp_fin_timeout
60
$ ulimit -n
1024
{code}

It's good to have a small value for ulimit -n (open files) to see we don't leak 
connections.

I played with TIME_WAIT and SO_LINGER, still the same behaviour.

I'm still convinced that it's an async issue, and it doesn't happen on your Mac 
nor on the Jenkins server. When I just put a {{Thread.sleep(2L);}} after each 
unbind it works, the 1 loop runs in approx. 50 seconds. I won't have much 
time to investigate this week, hopefully next week.


> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-08 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835346#comment-16835346
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Also what is the value of '{{ulimit}}' ? 

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835190#comment-16835190
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Just ran your test on my Mac OS X box, and I can run it more than 500 000 times 
in the loop before getting an error. Teh onkly thing I have to tune is the tcp 
TIME_WAIT parameter ({{net.inet.tcp.msl}} which default to 15s, and that I set 
to 1s (otherwise with the default value, it blocks after 16 000 loops).

But this is not a bug: at some point, all the socket are in TIME_WAIT, and the 
file_descriptor limit is reached on my machine (It's set to 16 000 more or 
less). There is nothing we can do, and chaningh the TIME_WAIT delay is not 
reasonnable.

On linux, the config for this parameter is given by :
{code}
cat /proc/sys/net/ipv4/tcp_fin_timeout
{code}

Which value do you have ?

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835136#comment-16835136
 ] 

Stefan Seelmann commented on DIRAPI-342:


Issue was that ldap-client-api had JUnit 5 as compile dependency, fixed here: 
https://github.com/apache/directory-ldap-api/commit/e5f269420b3aa743aab9b5ae1cfdc68d3f1e4429

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835125#comment-16835125
 ] 

Stefan Seelmann commented on DIRAPI-342:


Weird, the Jenkins job is too fast, not tests were exected: 
https://builds.apache.org/job/dir-server-pipeline/

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835103#comment-16835103
 ] 

Stefan Seelmann commented on DIRAPI-342:


Pushed here: 
https://github.com/apache/directory-server/commit/770a8ab20fb9c9a5a1d4a3d8c5ac3349252c915a

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16835010#comment-16835010
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Stefan can you push a diff of the test ? Thanks !

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834711#comment-16834711
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

If I configure the socket {{SO_LINGER}} parameter to 0, I can go a bit farther 
(up to 10 000 bind/unbind)

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834710#comment-16834710
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

The {{DelegatingAuthenticator}} binds to a remote server, but immediately 
unbinds as soon as the bind is successful (or fails). There is something wrong 
with the way we manage the internal LDAP connection in the server.

Definitively a server bug.


> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834661#comment-16834661
 ] 

Stefan Seelmann commented on DIRAPI-342:


CPU: i5-6200U, 4 cores
Linux: Archlinux, Kernel 5.0.5-arch1-1-ARCH
Java: openjdk version "1.8.0_212" and openjdk version "11.0.3"

For the test above I don't run with delegated auth, I just put it into the 
server-integ SimpleBindIT.java.

Sometimes it fails after 50th interation, sometimes only after the 5000th, but 
most of the time after some 100 iterations. I don't think its a socket issue, 
because when I create a new LdapNetworkConnection object (by moving the 
creation code into the loop) it works 1 times. I assume it's some state 
within the LdapNetworkConnection instance and/or some async event that changes 
state of the LdapNetworkConnection when already used by the next iteration.


> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834647#comment-16834647
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

When running the test with no sleep, the number of opened socket jumps to 17 
000 then it blocks (it started with 796).

Does not seems to be a API issue, much likely to be a server issue.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834605#comment-16834605
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Ok, my test was broken (it was not calling the delegated interceptor). I 
confirm there is an issue: without the 10ms sleep, it stops working after 8100 
calls (kind of). This is probably related to socket exhaustion, which means the 
delegated interceptor is probably opening a new connection for every bind, 
never closing it fast enough. I have to check that.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-07 Thread Emmanuel Lecharny (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16834465#comment-16834465
 ] 

Emmanuel Lecharny commented on DIRAPI-342:
--

Just ran the test on Mac OSX, it works just fine ( 10 000 bind/unbind in around 
7 seconds).

Which JVM version are you running the tests with ? Also can yoiu provide a bity 
of context (linux version, number of cores, etc)

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-04 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16833027#comment-16833027
 ] 

Stefan Seelmann commented on DIRAPI-342:


Oh, I just see the unbind() actually closes the connection always.

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (DIRAPI-342) Unbind breaks connection

2019-05-04 Thread Stefan Seelmann (JIRA)


[ 
https://issues.apache.org/jira/browse/DIRAPI-342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16833021#comment-16833021
 ] 

Stefan Seelmann commented on DIRAPI-342:


I'm not sure if the issue is within the API, or the server btw...

> Unbind breaks connection
> 
>
> Key: DIRAPI-342
> URL: https://issues.apache.org/jira/browse/DIRAPI-342
> Project: Directory Client API
>  Issue Type: Bug
>Affects Versions: 2.0.0.AM2
>Reporter: Stefan Seelmann
>Priority: Major
> Fix For: 2.0.0.AM3, 2.0.0
>
>
> 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):
> {code}
> @Test
> public void testSimpleBindAndUnbindLoop() throws Exception
> {
> try ( LdapConnection connection = new LdapNetworkConnection( 
> Network.LOOPBACK_HOSTNAME,
> getLdapServer().getPort() ) )
> {
> for ( int i = 0; i < 1; i++ )
> {
> System.out.println( i );
> connection.bind( "uid=admin,ou=system", "secret" );
> assertTrue( connection.isAuthenticated() );
> connection.unBind();
> assertFalse( connection.isAuthenticated() );
> // Thread.sleep( 10L );
> }
> }
> }
> {code}
> Without the unbind() or when sleeping for 10ms it works fine.
> Otherwise I saw 3 different errors:
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}
> {code}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)