Skip to main content


!Friendica Support
After the upgrade to 2023/04 my node sometimes has an Uncaught exception followed by
"MySQL server has gone away"

Do you have an idea how to fix this?

Thanks in advance.

2023-04-26T13:59:26Z worker [ERROR]: Uncaught exception in worker execution {"class":"mysqli_sql_exception","message":"Connection refused","code":2002,"file":"${FRIENDICA_ROOT}/src/Database/Database.php:189","trace":"#0 ${FRIENDICA_ROOT}/src/Database/Database.php(189): mysqli->__construct()\n#1 ${FRIENDICA_ROOT}/src/Database/Database.php(252): Friendica\\Database\\Database->connect()\n#2 ${FRIENDICA_ROOT}/src/Database/Database.php(709): Friendica\\Database\\Database->reconnect()\n#3 ${FRIENDICA_ROOT}/src/Database/Database.php(1511): Friendica\\Database\\Database->p()\n#4 ${FRIENDICA_ROOT}/src/Database/DBA.php(489): Friendica\\Database\\Database->select()\n#5 ${FRIENDICA_ROOT}/src/Worker/UpdateBlockedServers.php(38): Friendica\\Database\\DBA::select()\n#6 [internal function]: Friendica\\Worker\\UpdateBlockedServers::execute()\n#7 ${FRIENDICA_ROOT}/src/Core/Worker.php(572): call_user_func_array()\n#8 ${FRIENDICA_ROOT}/src/Core/Worker.php(386): Friendica\\Core\\Worker::execFunction()\n#9 ${FRIENDICA_ROOT}/src/Core/Worker.php(121): Friendica\\Core\\Worker::execute()\n#10 ${FRIENDICA_ROOT}/bin/worker.php(83): Friendica\\Core\\Worker::processQueue()\n#11 {main}","previous":null,"worker_id":"d4d1af9","worker_cmd":"UpdateBlockedServers"} - {"file":"Worker.php","line":577,"function":"execFunction","request-id":"64492d3a89d8e","uid":"c1e6bf","process_id":2743}

2023-04-26T13:59:26Z worker [NOTICE]: New retrial for task {"id":2975564,"created":"2023-04-26 02:50:01","old":0,"new":7,"worker_id":"d4d1af9","worker_cmd":"UpdateBlockedServers"}
 - {"file":"Worker.php","line":1364,"function":"getNextRetrial","request-id":"64492d3a89d8e","uid":"c1e6bf","process_id":2743}2023-04-26T13:59:26Z worker [ERROR]: DB Error {"code":2006,"error":"MySQL server has gone away","callstack":"DBA::update (1410), Worker::defer (578), Worker::execFunction (386), Worker::execute (121), Worker::processQueue (83)","params":"UPDATE `workerqueue` SET `retrial` = 7, `next_try` = '2023-04-26 15:51:35', `executed` = '0001-01-01 00:00:00', `pid` = 0, `priority` = 50 WHERE (`id` = 2975564)"}

Friendica Support reshared this.

in reply to Rebeka Catalina

This Connection refused and "MySQL server has gone away are message from the database server. This means that it can possibly be fixed by some server configuration. Possibly the new version (and some post update jobs) are stressing the system more than normal?

Friendica Support reshared this.

in reply to Michael Vogel

@Michael Vogel

Possibly the new version (and some post update jobs) are stressing the system more than normal?

I noticed that first cpu usage goes up to 100% and stays there and also RAM usage. It goes for a few minutes and then the mysqld goes down :-/

Friendica Support reshared this.

in reply to Michael Vogel

@Michael Vogel
I was able to capture some in screenshots:

Is this ok?

Oh and the top screenshot is the oldest and bottom the newest.

Friendica Support reshared this.

in reply to Rebeka Catalina

@Michael Vogel
Found out how to show the full queries in mytop... not easy to catch them - also I don't know which one is relavant so I now try catch some and post them in here one by one:

SELECT `id`, `url`, `nurl`, `network`, `poco`, `directory-type` FROM `gserver` WHERE (NOT `blocked` AND NOT `failed` AND `directory-type` != 0 AND `last_poco_query` < '2023-04-20T04:46:59+00:00') ORDER BY RAND()

Friendica Support reshared this.

in reply to Rebeka Catalina

When I remember it correctly, we have introduced some improved handling of blocked servers. Possibly this explains the higher load.

Friendica Support reshared this.

in reply to Michael Vogel

The two queries in comments above are those, which are always there when then load goes up. If they appear both - CPU and RAM usage - go to 100% immediately and stay there constantly until the mariadbd goes away. This happens every 15-20 minutes.

Friendica Support reshared this.

in reply to Rebeka Catalina

I guess that this is caused by a lot of entries in the gserver table caused by this troll system. I can try to find some way around this problem this evening.

Friendica Support reshared this.

in reply to Michael Vogel

@Michael Vogel
By reducing the set value of innodb_buffer_pool_size then mariadbd was not killed by oom-killer anymore. Another result is, that the system load is permanently a bit higher and swap usage is higher as well.

Friendica Support reshared this.

in reply to Michael Vogel

Not sure yet. It worked for about an hour - then I reduced it a bit more and it worked again for while, but then mariadbd has gone again. Now I switched the value back to the previous value and now testing again.

Friendica Support reshared this.

in reply to Michael Vogel

Yes, it looks like it's working now. Since about 5 hours it didn't happen again.

Friendica Support reshared this.

in reply to Raroun

@Raroun
Thanks for asking - actually I made a mistake and confused something. I'm sorry. This time it was not the mariadbd - it was the fpm.

Friendica Support reshared this.