LDAP connection lost after some time

LDAP connection lost after a while

One of my Nextcloud setups uses LDAP for authentication. Now I have the problem that it will lose connection to LDAP after a while. If I reboot the server it will work for a while again. If I browse to the site it will work as long as the connection to LDAP works but as fast as it loses the LDAP connection the site will never come up.
If I disable the user_Ldap plugin the page are working again.
The LDAP server (Nethserver) seems to function as it should.

/Pelle

Nextcloud version (eg, 20.0.5): 21.0.01
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 7.4.3

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): Y

The output of your Nextcloud log in Admin > Logging:

Error	core	OC\ServerNotAvailableException: Lost connection to LDAP server.	
/var/www/clients/client1/web3/web/apps/user_ldap/lib/LDAP.php - line 421:
OCA\User_LDAP\LDAP->processLDAPError()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/LDAP.php - line 344:
OCA\User_LDAP\LDAP->postFunctionCall()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/LDAP.php - line 64:
OCA\User_LDAP\LDAP->invokeLDAPMethod("*** sensiti ... *")
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Connection.php - line 664:
OCA\User_LDAP\LDAP->bind("*** sensiti ... *")
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Connection.php - line 578:
OCA\User_LDAP\Connection->bind("*** sensiti ... *")
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Connection.php - line 198:
OCA\User_LDAP\Connection->establishConnection()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Connection.php - line 206:
OCA\User_LDAP\Connection->init()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Access.php - line 1137:
OCA\User_LDAP\Connection->getConnectionResource()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Access.php - line 1320:
OCA\User_LDAP\Access->executeSearch()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Access.php - line 1025:
OCA\User_LDAP\Access->search()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Access.php - line 938:
OCA\User_LDAP\Access->searchGroups()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Group_LDAP.php - line 1121:
OCA\User_LDAP\Access->fetchListOfGroups()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Group_Proxy.php - line 244:
OCA\User_LDAP\Group_LDAP->getGroups()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Jobs/UpdateGroups.php - line 96:
OCA\User_LDAP\Group_Proxy->getGroups()
/var/www/clients/client1/web3/web/apps/user_ldap/lib/Jobs/UpdateGroups.php - line 89:
OCA\User_LDAP\Jobs\UpdateGroups->updateGroups("*** sensiti ... *")
/var/www/clients/client1/web3/web/lib/private/BackgroundJob/Job.php - line 52:
OCA\User_LDAP\Jobs\UpdateGroups->run()
/var/www/clients/client1/web3/web/lib/private/BackgroundJob/TimedJob.php - line 59:
OC\BackgroundJob\Job->execute()
/var/www/clients/client1/web3/web/cron.php - line 128:
OC\BackgroundJob\TimedJob->execute()

Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: OC\ServerNotAvailableException: Lost connection to LDAP server.
/var/www/clients/client1/web3/web/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:
{closure}("*** sensiti ... *")
/var/www/clients/client1/web3/web/3rdparty/sabre/dav/lib/DAV/Server.php - line 456:
Sabre\DAV\Server->emit()
/var/www/clients/client1/web3/web/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:
Sabre\DAV\Server->invokeMethod()
/var/www/clients/client1/web3/web/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:
Sabre\DAV\Server->start()
/var/www/clients/client1/web3/web/remote.php - line 76:
Sabre\DAV\Server->exec()
/var/www/clients/client1/web3/web/remote.php - line 169:
handleException()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Problem solved.
It seems to be some DNS problem causing this. I did enter the IP address for LDAP-server in /etc/hosts file and now everything have worked for one hour.

/Pelle

1 Like

thanks for posting your solution! Same problem drove me crazy for months. Now, 7 days without connection problems.