Issue 2862: Ldap connection gets lost
Status:  New
Owner: ----
Reported by asan.ser...@gmail.com, Aug 26, 2014
************************************************************
***** NOTE: THIS BUG TRACKER IS FOR GERRIT CODE REVIEW *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, INTERNAL *****
***** ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.    *****
***** THOSE ISSUE BELONG IN DIFFERENT ISSUE TRACKERS!  *****
************************************************************

Affected Version: Gerrit 2.9

What steps will reproduce the problem?
1. Stop ldap
2. try to logon to gerrit (it will fail)
3. start ldap
4. try to logon to gerrit again (it will continue failing)

What is the expected output? What do you see instead?
LDAP connection should be re-established as soon as LDAP is reachable again.

Please provide any additional information below.
If connection to LDAP gets lost (LDAP not available) following error is shown in the error log:
WARN  com.google.gerrit.server.auth.ldap.LdapGroupBackend : Cannot lookup membershipsOf <SomeUser> in LDAP
java.util.concurrent.ExecutionException: javax.naming.CommunicationException: <LdapServer>:<Port> [Root exception is java.net.ConnectException: Connection timed out]
...
Caused by: javax.naming.CommunicationException: <LdapServer>:<Port> [Root exception is java.net.ConnectException: Connection timed out]

Once LDAP is reachable again, gerrit is not recognizing this and throwing following error:
ERROR com.google.gerrit.server.auth.ldap.LdapRealm : Cannot query LDAP to authenticate user
javax.naming.CommunicationException: <LdapServer>:<Port> [Root exception is java.net.ConnectException: Connection refused]
…
Caused by: java.net.ConnectException: Connection refused

Only after restarting gerrit, the connection to LDAP gets established again.