Login failed after a random time (Browser or Client)

Since one month my Windows-Client failed after a random time to login in my Nextcloud. That happens once a week, so that I must reauthorized the client via my browser.
This behavior has worsened in the past few weeks. At the moment I must re-authenticate every 5 minutes or after an hour. This happens on several PC’s. Sometimes I also can’t login via the Browser Chrome and must switch to Firefox.

In the Nextcloud Log are no useful information printed:
Warning by trying to login with the Windows-Client:

{"reqId":"XXX","level":2,"time":"2020-04-08T21:14:26+00:00","remoteAddr":"XXXX","user":"User","app":"core","method":"GET","url":"/index.php/login/v2/flow/XXXX","message":"Renewing session token failed","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36","version":""}

Warning by trying to login with the Browser:

{"reqId":"XXX","level":2,"time":"2020-04-08T21:14:49+00:00","remoteAddr":"XXX","user":"--","app":"no app in context","method":"POST","url":"/index.php/login","message":"Login failed: User (Remote IP: XXX)","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36","version":""}

Here you can see, that Nextcloud opens a new session every time.

MYSQL error.log:

2020-04-08T21:14:20.311786Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 26911ms. The settings might not be optimal. (flushed=11 and evicted=0, during the time.)

PHP error.log:

[Tue Apr 08 21:14:31.352802 2020] [mpm_prefork:error] [pid 5482] (11)Resource temporarily unavailable: AH00159: fork: Unable to fork new process

Nextcloud version :
Operating system and version : Ubuntu 18.04.3 LTS
Apache version : 2.4.29
PHP version : 7.2.24

I hope you can advise me a little on this. Thanks for your help!

would you mind updating first to newest version (18.0.3 at the moment) since 18.0.0 turned out to be a bit buggy…

Unfortunately did not help.


have you tried a different browserr?
are you running your instance on a selfsigned certificate?

Yes i tired Firefox, but only to re-authenticate the Windows-Client. A few minutes (or hours) later, i have the same problem.
No, i am using Let’s Encrypt.

sorry… i can’t be of any further help… :frowning: - so i’m outta here

Nevertheless, many thanks.

As a guest it works fine. The guest can talk (with the “Talk”-App) many hours without any problems, but my registered User-Account (admin) have these login/connection problems after a random time.

so do i understand that correctly - if you’d use the same computer to login to your instance as a guest… it works more or less flawlessly?
what if you’d log in to a different, fully setup account?

Yes, it does. The problem occurs only with NC-Accounts.
I also tried different accounts, same problem.

2 Clients (Chrome and NC-Windows-Client) logged in as user1
1 Client (via Chrome) logged in as user2

-> NC-Windows-Client as user1 logged out after 5 minutes
-> Chrome as user2 logged out after 15 minutes
-> Chrome as user1 logged out after 20 minutes
(the time is random)

well… have you tried different hardware? just to make sure that the problem isn’t hardware connected?

The Server is hosted by Strato, so I have no real chance of changing the hardware.

hehehe… nono… i meant… could you check your connection to your strato-hosted server from another hardware?

ohh :smiley: Yes I did, on several PC’s and by friends. All have the same problem on my NC, if they are using an account.

so… well… maybe some app is interfering with something (guests usually have only few apps allowed). one way would be decativating all apps… and then activating them again one by one and see how that goes.

and yes, it’s a bunch of work. but i mean you already would notice if you’re on the right path after deactivating all apps. if my guessing was correct there shouldn’t be any problem with your connection.

Same problem here.

After much research, this is working for me since 1 week:

Change the following files in “/etc/apache2/mods-available”.
mpm_event.conf to:

<IfModule mpm_event_module>
	StartServers		 	4
	MaxClients           	30
	MinSpareThreads		 	20
	MaxSpareThreads		 	30
	ThreadLimit			 	64
	ThreadsPerChild		 	20
	MaxConnectionsPerChild 	0

mpm_prefork.conf to:

<IfModule mpm_prefork_module>
	StartServers		 	4
	MaxClients           	30
	MinSpareServers		  	10
	MaxSpareServers		 	20
	MaxConnectionsPerChild 	0

Restart apache2 and it should solve the problem.
Maybe you must chose different parameters depending on your system.
(Try and Error, https://httpd.apache.org/docs/2.4/de/mod/mpm_common.html)