Login Loop (HTTP 303): LoginController::tryLogin executed 1920 queries

Nextcloud version : 24.0.1
Operating system and version: Debian 5.10.106-1
Apache or nginx version: Apache: 2.4.53
PHP version: 8.0

The issue you are facing:
I cannot login into Nextcloud anymore. Upon clicking login, it is loading and redirects to login page. It does not display “Username / Password wrong”. (If I enter wrong credentials, that “Username / Password wrong” field comes up).

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

(Unclear if these steps are actually causing my issues!)

  1. Filled up OS disk to 100% (Nextcloud-Data disk still hat plenty of room)
  2. Updated to PHP 8 (due to apt-get full-upgrade, was not intential) (Apache stil used 7.4, same issue as now)
  3. Changed Apache to use PHP 8 FPM

The output of your Nextcloud log in Admin > Logging: Cannot access

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

<?php
$CONFIG = array (
  'debug' => true,
  'instanceid' => 'XXX',
  'passwordsalt' => 'XXXXXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => 'XXX',
    1 => 'XXX',
    2 => 'XXX',
  ),
  'datadirectory' => '/ncdata/',
  'dbtype' => 'mysql',
  'version' => '24.0.1.1',
  'overwrite.cli.url' => 'XXX',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.14:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'theme' => '',
  'log_type' => 'errorlog',
  'maintenance' => false,
  'default_phone_region' => 'DE',
  'auth.bruteforce.protection.enabled' => false,
  'mail_domain' => 'gmail.com',
  'mail_from_address' => 'XXX',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpname' => 'XXX@gmail.com',
  'mail_smtppassword' => 'XXX',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
  ),
  'data-fingerprint' => 'XXX',
);

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

[Sun Oct 30 14:43:42.900658 2022] [proxy_fcgi:error] [pid 15877:tid 139645662422784] [client 192.168.3.5:40706] AH01071: Got error 'PHP message: [owncloud][core][2] Controller OC\\Core\\Controller\\LoginController::tryLogin executed 1920 queries.'

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
Nextcloud.log file is empty and was not written to. Therefore, I changed the log-target to php error out: (apparently is visible in journalctl)

[proxy_fcgi:error] [pid 15877:tid 139645662422784] [client 192.168.3.5:40706] AH01071: Got error 'PHP message: [owncloud][core][2] Controller OC\\Core\\Controller\\LoginController::tryLogin executed 1920 queries.

Additional Info:
I checked that redis is running and is also available at /run/redis/redis-server.sock.
Via OCC i checked file integrity. Only additional files werde recorded, no altered ones.

The existing connection on my Nextcloud App still works. Meaning, it synced files successfully. I ruled out a DB Connection Problem, even though the 1920 queries are scary.

I have a similar problem when using Firefox and PHP 8.1. I have posted a full query here, since it is a slightly different situation.