Every 24h Cron Error UPDATE oc_jobs, Mysql Server has gone away

Hi, i noticed following cron error after update from NC 10.0.2 to NC 11.
My cron runs every 15 minutes but every day at nearly the same time (23:45-24:00) the cron jobs fails with the following error message:

{“reqId”:“s3A90E7TFAgoiVkwYjiZ”,“remoteAddr”:"",“app”:“PHP”,“message”:“Error while sending QUERY packet. PID=16308 at /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#91”,“level”:3,“time”:“2016-12-25T23:49:45+01:00”,“method”:"–",“url”:"–",“user”:"–",“version”:“11.0.0.10”}
{“reqId”:“s3A90E7TFAgoiVkwYjiZ”,“remoteAddr”:"",“app”:“cron”,“message”:“An exception occurred while executing ‘UPDATE oc_jobs SET reserved_at = ‘0’ WHERE id = ?’ with params [“7”]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away”,“level”:4,“time”:“2016-12-25T23:49:45+01:00”,“method”:"–",“url”:"–",“user”:"–",“version”:“11.0.0.10”}

Any ideas or solution for this ?
Thanks in advanced, regards

A bit strange since the oc_jobs table shouldn’t be very large. Can you check this table and post it here?

can you disable nextant for tonight ? :]

Hi,
@Cult Nextant isn´t active at the moment.
Before the log messages i posted there was a entry that the packet is to big , i have now increases it to 16 MB in mariadb default was 1 MB but i don’t know wether this is really necessary ?
@tflidd Thats the output from oc_jobs:

MariaDB [owncloud]> select * from oc_jobs;
±—±--------------------------------------------------±---------------------------------------------±-----------±-------------±------------+
| id | class | argument | last_run | last_checked | reserved_at |
±—±--------------------------------------------------±---------------------------------------------±-----------±-------------±------------+
| 1 | OCA\Files_Versions\BackgroundJob\ExpireVersions | null | 1482936307 | 1482936307 | 0 |
| 4 | OCA\Files\BackgroundJob\ScanFiles | null | 1482936304 | 1482936307 | 0 |
| 5 | OCA\Files\BackgroundJob\DeleteOrphanedItems | null | 1482936304 | 1482936304 | 0 |
| 6 | OCA\Files\BackgroundJob\CleanupFileLocks | null | 1482936304 | 1482936304 | 0 |
| 7 | OCA\DAV\CardDAV\SyncJob | null | 1482879605 | 1482936304 | 0 |
| 8 | OCA\Federation\SyncJob | null | 1482882304 | 1482936304 | 0 |
| 9 | OCA\Activity\BackgroundJob\EmailNotification | null | 1482936304 | 1482936304 | 0 |
| 10 | OCA\Activity\BackgroundJob\ExpireActivities | null | 1482880504 | 1482936304 | 0 |
| 11 | OCA\Files_Trashbin\BackgroundJob\ExpireTrash | null | 1482936304 | 1482936304 | 0 |
| 12 | OC\BackgroundJob\Legacy\RegularJob | [“OCA\Files_Antivirus\Cron\Task”,“run”] | 1482936305 | 1482936305 | 0 |
| 15 | OC\BackgroundJob\Legacy\RegularJob | [“OCA\News\Cron\Updater”,“run”] | 1482936306 | 1482936306 | 0 |
| 16 | OC\BackgroundJob\Legacy\RegularJob | [“OCA\Music\Backgroundjob\CleanUp”,“run”] | 1482936306 | 1482936306 | 0 |
| 19 | \OC\Authentication\Token\DefaultTokenCleanupJob | null | 1482936307 | 1482936307 | 0 |
| 21 | OCA\UpdateNotification\Notification\BackgroundJob | null | 1482880505 | 1482936307 | 0 |
| 23 | OCA\DAV\CardDAV\Sync\SyncJob | null | 0 | 1482921902 | 1482921902 |
| 24 | OCA\Files_Sharing\DeleteOrphanedSharesJob | null | 1482936307 | 1482936307 | 0 |
| 25 | OCA\Files_Sharing\ExpireSharesJob | null | 1482880564 | 1482936307 | 0 |
| 35 | OCA\UpdateNotification\ResetTokenBackgroundJob | null | 1482936307 | 1482936307 | 0 |
| 46 | OC\Log\Rotate | “/clouddata/owncloud.log” | 1482936307 | 1482936307 | 0 |
| 48 | OCA\NextcloudAnnouncements\Cron\Crawler | null | 1482881405 | 1482936307 | 0 |
| 50 | OCA\Files_Antivirus\Cron\Task | null | 1481970604 | 1482924603 | 1482924603 |
±—±--------------------------------------------------±---------------------------------------------±-----------±-------------±------------+
21 rows in set (0.00 sec)

hope this helps ?
regards

edit: think its better to read as screenshot:

The default settings of the database is very likely not the best for our purpose. Perhaps we should add a howto or something because this can improve the performance drastically.
If the changes don’t help, I would try to disable the antivirus app. It’s not that often use, known to have caused some problems and likely to use a certain amount of resources.

Thats okay if the people know that 1MB max_packet_size (MariaDB 5.x.x) are not enough, or in other words the mariadb default settings are not enough. I think in MariaDB version 10 + the default packet size is increased to 16M

Solution for Centos 7:

Edit the /etc/my.cnf and insert under the [mysqld] section max_allowed_packet=16M.
Example:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
max_allowed_packet=16M

Edit: restart sql server after change my.cnf

@tflidd The Antivirus App is not active at the moment because they have the old scan issue… but i don’t know why the entry in oc_jobs is still present ?

I check tomorrow wether the error is still present after cron run this night. cross fingers :wink:

I would just delete the cronjob related to the Antivirus.

Do you still get the error message?

After i increased the max_allowed_packet in /etc/my.cnf from default 1MB to 16MB the error is gone. :smiley:

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
max_allowed_packet=16M

regards