NextCloud 16 on OVH: has more than 'max_user_connections' active connections on sql database

I have running NextCloud 16 on an OVH WebHosting-Server.

We have a lot of timeouts on the webserver which are resulting on non-database-responses.
In the error_log, we are seeing a lot of errors like this:

Error: Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1203] User xxx already has more than ‘max_user_connections’ active connections at <>
0. /home/xxx/files/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 448
OC\DB\Connection->connect()

Can I limit the max_user_connections on NextCloud side?
I can’t modify it on OVH-side.

Thanks,
Tom

I think this is usually a question which you should ask your hosting provider, because it is a database specific limit which has been set and not a Nextcloud issue.

Asking aunt G. for help shows me the following answers:

Yes, I know this. But the provider can’t or don’t want to modify it.

My questiomn is if I can Iimit it on NextCloud side?

Thanks,
Tom

How should Nextcloud override a database specific parameter? That’s technically impossible.

Nextcloud shoud take care about how many connections it will open.

The database and the database user is only used by NextCloud, so the client has to handle connections. Something like handling size of the connection pool…

A client cannot override a setting which has been set for the whole server. As far as I understood the parameter description, it is a database server dependent parameter and not database dependent one. If the database server is also only used by Nextcloud, then you should remove or increase the limit value.

1 Like

It’s now February 24 and I’m experiencing the same problem.

Recently (I can’t say whether since a certain server update), I’ve also been experiencing these errors. Especially when several uploads occur one after the other due to the Android client autoupload. But also in many other situations.

It is very annoying and data is lost in the process (autouploads). When these errors occur, error messages such as “Server not found”, etc. appear in the Android client. The autoupload is then cancelled and is later no longer recorded for some files, or is refused with error messages such as “folder error” or “local file not available” (although the file is available).

According to information from webgo, I have 15 database users. Nevertheless, these errors are so frequent that certain functions of my cloud are practically unusable.

Exception

Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1203] User web39_5 already has more than 'max_user_connections' active connections

Exception thrown: Doctrine\DBAL\Exception

Presumably, Nextcloud uses several users at the same time to be able to work faster. If this is the case, however, Nextcloud must limit the number of maximum users in order to avoid these disruptions.

At this point, my research in this forum has unfortunately been unsuccessful. Obviously, this problem is rare and may even be limited to webgo.

In another post I read that configuring a memcache would greatly reduce database accesses - but wegbo can’t turn on memcache.

So what to do?

No that’s not the case. According to the MariaDB documentation the max_user_connections parameter sets the maximum number of active connections for a single user.

There is probably not much you can do about this. Your web hosting provider would have to increase this value for you.

However, if they’re for example using this to segment their offerings, so that the larger plans offer more database connections, they probably won’t, but maybe you could upgrade to higher tier plan. Also, more connections increases the load on their database servers, which is why they have limits in the first place.

At the end of the day, and this certainly depends on the specific provider and the plan you are using, i’d say that traditional web hosting plans are less and less suitable for hosting Nextcloud, which is a full-blown file sharing and collaboration platform by now.

A little addition…

You could of course try to disable apps that you don’t necessarily need, and in theory it would also be possible that a bug somewhere in Nextcloud or in one of the apps triggers an unusually high number of database connections.

But to be honest, I think it is much more likely that your particular web hosting plan simply isn’t suitable for hosting a software like Nextcloud, which requires significantly more database connections compared to e.g. a CMS system like Wordpress, for which these webhosting plans are primarily meant to be used for.

And maybe that’s just me, but I can’t really get my head round the idea of restricting Nextcloud. At least according to my logic, it makes much more sense to find a better suited hosting option. :wink: