Skip to main content


First ever instance crash. Suggestions for avoiding this in the future?


!Friendica Support
I had my first-ever server crash of my-place.social. This is in syslog:

2024-11-18T21:34:49.022603-05:00 my-place php: PHP Fatal error: Uncaught mysqli_sql_exception: Too many connections in /var/www/html/src/Database/Database.php:201
2024-11-18T21:34:49.022822-05:00 my-place php: Stack trace:
2024-11-18T21:34:49.022855-05:00 my-place php: #0 /var/www/html/src/Database/Database.php(201): mysqli->__construct()
2024-11-18T21:34:49.022885-05:00 my-place php: #1 /var/www/html/src/Database/Database.php(106): Friendica\Database\Database->connect()
2024-11-18T21:34:49.022911-05:00 my-place php: #2 [internal function]: Friendica\Database\Database->__construct()
2024-11-18T21:34:49.022933-05:00 my-place php: #3 /var/www/html/vendor/level-2/dice/Dice.php(132): ReflectionMethod->invokeArgs()
2024-11-18T21:34:49.022958-05:00 my-place php: #4 /var/www/html/vendor/level-2/dice/Dice.php(96): Dice\Dice->Dice\{closure}()
2024-11-18T21:34:49.022985-05:00 my-place php: #5 /var/www/html/vendor/level-2/dice/Dice.php(247): Dice\Dice->create()
2024-11-18T21:34:49.023014-05:00 my-place php: #6 /var/www/html/vendor/level-2/dice/Dice.php(132): Dice\Dice->Dice\{closure}()
2024-11-18T21:34:49.023049-05:00 my-place php: #7 /var/www/html/vendor/level-2/dice/Dice.php(96): Dice\Dice->Dice\{closure}()
2024-11-18T21:34:49.023074-05:00 my-place php: #8 /var/www/html/vendor/level-2/dice/Dice.php(247): Dice\Dice->create()
2024-11-18T21:34:49.023100-05:00 my-place php: #9 /var/www/html/vendor/level-2/dice/Dice.php(132): Dice\Dice->Dice\{closure}()
2024-11-18T21:34:49.023125-05:00 my-place php: #10 /var/www/html/vendor/level-2/dice/Dice.php(96): Dice\Dice->Dice\{closure}()
2024-11-18T21:34:49.023147-05:00 my-place php: #11 /var/www/html/index.php(34): Dice\Dice->create()
2024-11-18T21:34:49.023172-05:00 my-place php: #12 {main}
2024-11-18T21:34:49.023208-05:00 my-place php: thrown in /var/www/html/src/Database/Database.php on line 201

show variables like 'max_connections'; shows 151 max_connections.

I did: SET GLOBAL max_connections = 200;

I also edited /etc/mysql/mariadb.conf.d/50-server.cnf and set max_connections = 200

Is this too high? Too low? Did I do this the correct way?

Thank you!

Thanks!

#3 #1 #2 #10 #4 #5 #6 #11 #12 #8 #9 #7 !Friendica Support
in reply to Jerry on Friendica

@Jerry on Friendica Not an expert but you should try to increase this value by at least doubling it.

Beyond your own users, your server is receiving requests from every other Fediverse instance your users are interacting with through their follows and followers, and their number will be ever increasing.

in reply to Hypolite Petovan

Thanks! I just bumped it to 400. That's 4 times more than the default.

I hope 400 isn't exceeding some limit. I hope I did this correctly. 🥴

in reply to Jerry on Friendica

@Jerry on Friendica Yes, the default values don't really apply to Friendica which is a database-heavy application because of the federation aspect.
in reply to Jerry on Friendica

What would happen if one were to increase this value by several orders of magnitude (e.g. 5,000 or 50,000)?

In other words, what are noticeable signs of a too high setting?

@Hypolite Petovan @Jerry on Friendica @Roland Häder

in reply to Andy H3

@Andy H3 @Roland Häder @Jerry on Friendica With a too high number you open your server to DOS attacks where your server accept more connections that it can actually handle, queueing them forever. It's a balancing act but it should never affect regular use.
⇧