craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

[3.x]: MySQL crashes when searching in the CMS #12562

Closed Harry-Harrison closed 1 year ago

Harry-Harrison commented 1 year ago

What happened?

Description

It seems that MySQL is crashing when I search through the CMS on an entries table. This results in the site being knocked offline while it reboots and the public view is "Craft hasnt been installed yet". This only happens on the live site and not on my local.

When I check the PHPErrors.log file I see the following

Next yii\db\Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
The SQL being executed was: SELECT COUNT(*)
FROM (SELECT 1
FROM `sites`
LIMIT 2) `x` in /home/forge/REDACTED/vendor/yiisoft/yii2/db/Schema.php:676

Steps to reproduce

  1. Search on an entries table or commerce entries table.

Expected behavior

Search results to be returned.

Actual behavior

MySQL crashes and the search hangs in the admin (presumably because mysql has crashed).

Craft CMS version

Craft Pro 3.7.62

PHP version

8.0.19

Operating system and version

Linux 5.4.0-107-generic

Database type and version

MySQL 8.0.30 (On a DigitalOcean DB cluster)

Image driver and version

Imagick 3.6.0 (ImageMagick 6.9.10-23)

Installed plugins and versions

angrybrad commented 1 year ago

Unfortunately, that's one of those generic MySQL error messages that could mean many things.

Typically when we see it, it’s because the MySQL max_allowed_packet config setting is set too low on the server, or the wait_timeout setting is. Try bumping those up to higher values.

If that doesn’t fix it, there are other solutions to try in the official MySQL documentation on the subject: https://dev.mysql.com/doc/refman/8.0/en/gone-away.html

Hope that helps!