Problems interacting with the Fediverse, "MySQL server has gone away"
System
Castopod 1.4.2 running on PHP 8.1 on a shared hosting environment
Problems
- Posts from Castopod are not sent out to the Fediverse.
- There are no notifications when someone from the Fediverse sends a post to the Castopod instance.
The problems are occuring since about June 2023 without any change in the system or in the Castopod installation.
Further notes
The cronjob has been updated to spark:tasks and seems to run. The output of the cronjob is:
CodeIgniter v4.2.7 Command Line Tool - Server Time: 2023-08-23 19:11:02 UTC+00:00
Running Tasks...
[2023-08-23 19:11:02] Processing: fediverse-broadcast
[2023-08-23 19:15:40] Failed: fediverse-broadcast
[2023-08-23 19:15:40] Processing: websub-publish
[2023-08-23 19:15:40] Failed: websub-publish
[2023-08-23 19:15:40] Processing: video-clips-generate
[2023-08-23 19:15:40] Failed: video-clips-generate
[2023-08-23 19:15:40] Processing: podcast-import
[H[2J[2023-08-23 19:15:40] Executed: podcast-import
Completed Running Tasks
The anonymized log entries of one cronjob run are attached to this issue.
Research
-
max_allowed_packet
is set to default (about 67 MB) -
wait_timeout
is 120 seconds only and cannot be changed in this environment.
The SELECT
statements for the cronjobs are executed fast and smoothly. But time is lost when connecting to other Fediverse instances.
It seems that a lot of time is lost connecting a Mastodon instance which is not available anymore. There are time-outs logged for this.
My suspicion is: Connecting to the Fediverse instances takes too long. Because of that and the low wait_timeout
setting the database connection is lost ("MySQL server has gone away").
I'm not using Codeigniter myself but there is a reconnect function. Maybe this would be an easy fix to implement to take care of cases like that.
Thank you! I'm happy to answer any question to help here.
This issue is based on this conversation in Discord.