We think these connection problems are mostly a side-effect of our Apache PHP-CGI stack.
What happens is that on PHP-CGI each individual request is spawning a new PHP process with its own DB connection. If your site gets a ton of traffic all at once then it can quickly run out of available connections.
We're working on improving the PHP stack to mitigate this problem.
The connection error can also happen if you've set up a single DB user for all of your MariaDB databases. The connection limit is 30 per DB user (and we're not raising it) so if you've got a single DB user connecting to multiple databases, that user will run out of connections very quickly. If this sounds like you, then make a DB user for each of your app's databases and use that in your application config.
If you absolutely need a higher number of per-user DB connections then please use a private MariaDB: HOWTO install and run a private MariaDB server instance on Opalstack - Opalstack Community Forum