Problems with image previews (General error: 2006 MySQL server has gone away)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 14.0.3
Operating system and version (eg, Ubuntu 17.04): 18.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.29
PHP version (eg, 7.1): 7.2
MySQL version: 5.7

The issue you are facing:
Previews won’t generate, high CPU on the server for about a minute, MySQL database error

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Login to Nextcloud
  2. Open a folder with JPEG files
  3. Scroll up/down or open an image file to preview

The output of your Nextcloud log in Admin > Logging:

|Error|core|Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum` FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ?' with params [1, "bb771707935cb95bdf8dcab8a7d20686"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away|November 3, 2018, 4:55 pm|
|---|---|---|---|
|Error|core|Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `fileid` FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ?' with params [1, "9125e05a4cd02e5f5884767164d1ee22"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away|November 3, 2018, 4:55 pm|
|Error|index|Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `fileid` FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ?' with params [1, "9125e05a4cd02e5f5884767164d1ee22"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away|November 3, 2018, 4:55 pm|
|Error|PHP|Error while sending QUERY packet. PID=5144 at /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php#105|November 3, 2018, 4:55 pm|
|Error|core|Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum` FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ?' with params [1, "bb771707935cb95bdf8dcab8a7d20686"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away|November 3, 2018, 4:55 pm|
|Error|core|Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'SELECT `fileid` FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ?' with params [1, "422c7fa2cef4d8269e43087d207c9823"]: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away|November 3, 2018, 4:55 pm|

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "xxx.com",
            "www.xxx.com",
            "localhost"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "htaccess.RewriteBase": "\/cloud\/",
        "dbtype": "mysql",
        "version": "14.0.3.0",
        "overwrite.cli.url": "https:\/\/xxx.com\/cloud",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "cache_path": "\/home\/bisherbas\/nextclouddata\/cache",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_smtpauthtype": "LOGIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "log_type": "file",
        "logfile": "\/home\/bisherbas\/nextclouddata\/mynextcloud.log",
        "loglevel": 3,
        "logtimezone": "America\/New_York",
        "logdateformat": "F j, Y, g:i a",
        "log_rotate_size": 10485760,
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "theme": "",
        "enable_previews": true,
        "preview_max_x": 2048,
        "preview_max_y": 2048,
    }
}

The output of your Apache/nginx/system log in /var/log/____:

[Sat Nov 03 16:55:25.795575 2018] [php7:error] [pid 8110] [client 1.2.3.4:5] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/xxx.com/html/cloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/xxx.com/html/cloud/lib/private/DB/Connection.php(151): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/xxx.com/html/cloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__con in /var/www/xxx.com/html/cloud/lib/private/DB/Connection.php on line 64

my.cnf:

[mysqld]
 connect_timeout=60
 wait_timeout=60
 interactive_timeout=60
 max_allowed_packet=16M

php.ini

max_execution_time = 120
max_input_time = 60
memory_limit = 512M
1 Like

Anybody have any suggestions?

I’m getting that same error also, please see here.