Authentication timing out

Nextcloud version: 25.0.1
Operating system and version: Docker version 20.10.19 on Debian Bookworm
Apache or nginx version: apache, the one present in the nextcloud:25-apache docker image
PHP version: the one present in the nextcloud:25-apache docker image

The issue you are facing:

Password-based authentication on /index.php/login takes extremely long time to authenticate any user, frequently causing a timeout in the browser, thus making the login fail.

This is not the issue of invalid credentials, because the server responds quickly about those, and a “Wrong username or password.” notification correctly appears. In case the credentials are correct, the server takes a very long time to respond. I have 3 users, out of which 2 are affected, 1 (happens to be the admin account) is not.

It is notable that the corresponding POST request, which carries the credentials, only shows up a few minutes afterwards. All the other requests are included in the log in time. I suspect this is because the php server does not reply for a long time, so the apache server waits for the status code to be included in the log entry.

Around the time of a timed out login attempt, nothing is printed either in the apache error log, data/nextcloud.log and the Administration > Logging view. (This is a docker install, so where applicable, I checked the output of the docker logs command and the files themselves as well.)

Edit: I have also tried disabling all non-default apps, but I’m still facing this issue.

Is this the first time you’ve seen this error? : Y (based on user reports, this issue may have been consisting for several Nextcloud versions.)

Steps to replicate it:

I cannot replicate this issue reliably.

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

My docker-compose.yml file:
Pastebin

Are you by chance using the built-in Collabora server? If so, try disabling that as well.

Thanks, but I do not use the Collabora server.

I have tried switching to FPM from the apache-based solution, and the issue still persists.

Digging through the database, it turned out that affected accounts had thousands of auth tokens in the oc_authtoken table. Based on an old reply on another thread, having many of these slows down the login process vastly.

I have deleted tokens of these users, and authentication is fast again.

1 Like