Internal server error when opening settings

[/details]

Nextcloud version : 21.0.5
Operating system and version: Ubuntu 20.04
Apache or nginx version; Apache 2.4.41
PHP version 7.4.3

The issue you are facing:
After update to version 21.0.5 we are facing an isue with LDAP. If LDAP is installed and activated in nextcloud I get an internal server error when I want to open the settings page. If I uninstall LDAP I can open the Settings section.
All my users are LDAP accounts so this functionality is really important.

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

Steps to replicate it:

  1. Log in with admin account
  2. open Settigns

The output of your Nextcloud log in Admin > Logging:

Cannot access the Admin Logging Section, because it is in the settings, which I cannot access anymore

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

<?php
$CONFIG = array (
  'passwordsalt' => 'xxxxxxxxxx',
  'secret' => 'xxxxxxxxxx/',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '10.50.0.15',
    2 => 'nextcloud',
    3 => 'nextcloud',
    4 => 'nextcloud.ourdomain.com',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '21.0.2.1',
  'overwrite.cli.url' => 'https://nextcloud/',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ncadmin',
  'dbpassword' => 'FrbaHR=xxxxxxxxx',
  'installed' => true,
  'instanceid' => 'ochl703lxlva',
  'upgrade.disable-web' => 'true',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'log.condition' => 
  array (
    'apps' => 
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => '172800',
  'log_rotate_size' => '0',
  'trashbin_retention_obligation' => 'auto, 180',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 0,
    'password' => 'yyyyyyyyyyyyyy*',
  ),
  'logtimezone' => 'Europe/Vienna',
  'htaccess.RewriteBase' => '/',
  'share_folder' => '/Shared',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
  'mail_from_address' => 'nextcloud',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'ourdomain.com',
  'mail_smtphost' => 'mail.ourdomain.com',
  'mail_smtpport' => '25',
);

.....
Thank you for any input

We got the same when attempting to update from 21.0.4 to 21.0.5.
Admin cannot access settings and other users (that are connected to LDAP) cannot access anything.

The log is full of these messages:

[index] Error: OC\ServerNotAvailableException: Lost connection to LDAP server. at <<closure>>

 0. /var/www/html/apps/user_ldap/lib/LDAP.php line 421
    OCA\User_LDAP\LDAP->processLDAPError("*** sensitive parameter replaced ***")
 1. /var/www/html/apps/user_ldap/lib/LDAP.php line 344
    OCA\User_LDAP\LDAP->postFunctionCall()
 2. /var/www/html/apps/user_ldap/lib/LDAP.php line 64
    OCA\User_LDAP\LDAP->invokeLDAPMethod("*** sensitive parameters replaced ***")
 3. /var/www/html/apps/user_ldap/lib/Connection.php line 664
    OCA\User_LDAP\LDAP->bind("*** sensitive parameters replaced ***")
 4. /var/www/html/apps/user_ldap/lib/Connection.php line 578
    OCA\User_LDAP\Connection->bind("*** sensitive parameters replaced ***")
 5. /var/www/html/apps/user_ldap/lib/Connection.php line 198
    OCA\User_LDAP\Connection->establishConnection()
 6. /var/www/html/apps/user_ldap/lib/Connection.php line 206
    OCA\User_LDAP\Connection->init()
 7. /var/www/html/apps/user_ldap/lib/Access.php line 1262
    OCA\User_LDAP\Connection->getConnectionResource()
 8. /var/www/html/apps/user_ldap/lib/Access.php line 1012
    OCA\User_LDAP\Access->count("(&(&(|(objectcl ... )", ["ou=people,dc=gams,dc=com"], ["dn"], null, null)
 9. /var/www/html/apps/user_ldap/lib/User_LDAP.php line 565
    OCA\User_LDAP\Access->countUsers("(&(&(|(objectcl ... )")
10. /var/www/html/apps/user_ldap/lib/User_Proxy.php line 350
    OCA\User_LDAP\User_LDAP->countUsers()
11. /var/www/html/apps/support/lib/Service/SubscriptionService.php line 128
    OCA\User_LDAP\User_Proxy->countUsers()
12. /var/www/html/apps/support/lib/Service/SubscriptionService.php line 269
    OCA\Support\Service\SubscriptionService->getUserCount()
13. /var/www/html/apps/support/lib/Subscription/SubscriptionAdapter.php line 51
    OCA\Support\Service\SubscriptionService->getSubscriptionInfo()
14. /var/www/html/lib/private/Support/Subscription/Registry.php line 141
    OCA\Support\Subscription\SubscriptionAdapter->hasValidSubscription()
15. /var/www/html/apps/settings/lib/Settings/Personal/ServerDevNotice.php line 104
    OC\Support\Subscription\Registry->delegateHasValidSubscription()
16. /var/www/html/lib/private/Settings/Manager.php line 185
    OCA\Settings\Settings\Personal\ServerDevNotice->getSection()
17. /var/www/html/lib/private/Settings/Manager.php line 299
    OC\Settings\Manager->getSettings("personal", "additional")
18. /var/www/html/lib/private/Settings/Manager.php line 260
    OC\Settings\Manager->getPersonalSettings("additional")
19. /var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php line 116
    OC\Settings\Manager->getPersonalSections()
20. /var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php line 64
    OCA\Settings\Controller\PersonalSettingsController->formatPersonalSections("personal", "personal-info")
21. /var/www/html/apps/settings/lib/Controller/CommonSettingsTrait.php line 148
    OCA\Settings\Controller\PersonalSettingsController->getNavigationParameters("personal", "personal-info")
22. /var/www/html/apps/settings/lib/Controller/PersonalSettingsController.php line 68
    OCA\Settings\Controller\PersonalSettingsController->getIndexResponse("personal", "personal-info")
23. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 218
    OCA\Settings\Controller\PersonalSettingsController->index("personal-info")
24. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 127
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Settings\Con ... {}, "index")
25. /var/www/html/lib/private/AppFramework/App.php line 157
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Settings\Con ... {}, "index")
26. /var/www/html/lib/private/Route/Router.php line 302
    OC\AppFramework\App::main("OCA\\Settings\\ ... r", "index", OC\AppFramework\ ... {}, {section: "perso ... "})
27. /var/www/html/lib/base.php line 993
    OC\Route\Router->match("/settings/user")
28. /var/www/html/index.php line 37
    OC::handleRequest()

GET /settings/user
from 172.17.0.1 by distrib at 2021-10-09T17:30:17+00:00

LDAP is OpenLDAP.