Nightly error messages. Any ideas?

I installed ownCloud v 10.7 on my Synology NAS (directly, NOT via Docker). It works perfectly - apart from a couple of nightly error logs in my data folder every couple of days or so. I would be really grateful if anyone could suggest what might be wrong.

I am using PHP 7.4 and MariaDB 10. I have clients using CardDAV and CalDAV and my web browsers sync their bookmarks using floccus and an .xbel file which is accessed via a WebDAV link. I have ownCloud clients on my iPhone, my Windows box and on two Macs. I use redis for file locking and get no errors at all in the ownCloud Settings/System. Everything works without any issues - apart from the error messages referred to above. When I do ‘…settings/integrity/failed’ I get ‘No errors have been found’.

I have made sure permissions on the ownCloud and ownCloud data folders are correct:

chown -R http:http /volume1/web/owncloud/
chown -R http:http /volume1/web/owncloud/apps/
chown -R http:http /volume1/web/owncloud/config/
chown -R http:http /volume1/owncloudData/
chown http:http /volume1/web/owncloud/.htaccess
find /volume1/web/owncloud/ -type f -print0 | xargs -0 chmod 777
find /volume1/web/owncloud/ -type d -print0 | xargs -0 chmod 777
find /volume1/owncloudData/ -type d -print0 | xargs -0 chmod 777
chmod 777 /volume1/web/owncloud/.htaccess

I access my ownCloud install via my own domain - I have a CNAME record with my domain host and a commercial SSL certificate.

This is my config.php - with sensitive information replaced by xxx:

<?php
$CONFIG = array (
  'instanceid' => ‘x’xxx,
  'passwordsalt' => ‘/xxxx’,
  'secret' => 'xxxxc',
  'trusted_domains' => 
  array (
    0 => 'owncloud.xxxx.net',
    1 => '192.168.xx.xx’,
  ),
  'datadirectory' => '/volume1/owncloudData',
  'overwrite.cli.url' => 'https://owncloud.xxxx.net',
  'dbtype' => 'mysql',
  'version' => '10.7.0.4',
  'dbname' => 'OwnCloud',
  'dbhost' => '127.0.0.1:3307',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin2',
  'dbpassword' => 'xxxx’,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array
  (
    'host' => '127.0.0.1',
    'port' => '6379',
    'timeout' => '0',
    'dbindex' => '0',
  ),
  'mail_from_address' => ‘xxxx’,
  'mail_smtpmode' => 'smtp',
  'mail_domain' => ‘xxxx.net',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.xxxx.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => ‘xxxx@xxxx’.xxxx,
  'mail_smtppassword' => ‘xxxx’,
  'mail_smtpsecure' => 'ssl',
  'default_phone_region' => 'GB',
  'logtimezone' => 'UTC',
  'htaccess.RewriteBase' => '/',
  'trashbin_retention_obligation' => 'auto, 10',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/volume1/web/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/volume1/web/owncloud/apps-external',
      'url' => '/apps-external',
      'writable' => true,
    ),
  ),
  'installed' => true,
);

The error messages are all pretty much the same. I get two or three each night.

"date": "2021-04-07T01:57:15+00:00", /r
    "parentId": null,
    "id": "7c1de5089fa20b9b2781cb597c4f4b1f606d117bac7bd5.31852171",
    "class": "Doctrine\\DBAL\\DBALException",
    "message": "Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused",
    "stacktrace": [
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php",
            "line": 428,
            "function": "connect",
            "class": "OC\\DB\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php",
            "line": 388,
            "function": "getDatabasePlatformVersion",
            "class": "Doctrine\\DBAL\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php",
            "line": 330,
            "function": "detectDatabasePlatform",
            "class": "Doctrine\\DBAL\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php",
            "line": 695,
            "function": "getDatabasePlatform",
            "class": "Doctrine\\DBAL\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/DB\/Connection.php",
            "line": 144,
            "function": "setTransactionIsolation",
            "class": "Doctrine\\DBAL\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DriverManager.php",
            "line": 194,
            "function": "__construct",
            "class": "OC\\DB\\Connection"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/DB\/ConnectionFactory.php",
            "line": 138,
            "function": "getConnection",
            "class": "Doctrine\\DBAL\\DriverManager"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 536,
            "function": "getConnection",
            "class": "OC\\DB\\ConnectionFactory"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/pimple\/pimple\/src\/Pimple\/Container.php",
            "line": 118,
            "function": "OC\\{closure}",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php",
            "line": 108,
            "function": "offsetGet",
            "class": "Pimple\\Container"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/ServerContainer.php",
            "line": 86,
            "function": "query",
            "class": "OC\\AppFramework\\Utility\\SimpleContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 1239,
            "function": "query",
            "class": "OC\\ServerContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 412,
            "function": "getDatabaseConnection",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/pimple\/pimple\/src\/Pimple\/Container.php",
            "line": 118,
            "function": "OC\\{closure}",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php",
            "line": 108,
            "function": "offsetGet",
            "class": "Pimple\\Container"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/ServerContainer.php",
            "line": 86,
            "function": "query",
            "class": "OC\\AppFramework\\Utility\\SimpleContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 1169,
            "function": "query",
            "class": "OC\\ServerContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 591,
            "function": "getAppConfig",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/composer\/pimple\/pimple\/src\/Pimple\/Container.php",
            "line": 118,
            "function": "OC\\{closure}",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php",
            "line": 108,
            "function": "offsetGet",
            "class": "Pimple\\Container"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/ServerContainer.php",
            "line": 86,
            "function": "query",
            "class": "OC\\AppFramework\\Utility\\SimpleContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/Server.php",
            "line": 1437,
            "function": "query",
            "class": "OC\\ServerContainer"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/legacy\/app.php",
            "line": 344,
            "function": "getAppManager",
            "class": "OC\\Server"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/private\/legacy\/app.php",
            "line": 108,
            "function": "getEnabledApps",
            "class": "OC_App"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/base.php",
            "line": 583,
            "function": "loadApps",
            "class": "OC_App"
        },
        {
            "file": "\/volume1\/web\/owncloud\/lib\/base.php",
            "line": 1058,
            "function": "init",
            "class": "OC"
        },
        {
            "file": "\/volume1\/web\/owncloud\/remote.php",
            "line": 110,
            "function": "require_once"
        }
    ]
}

Hi,

just a blind guess:

Might there be an issue with availability of the MYSQL database? Do you have root permissions for the database? Do you see any restarts or so in the database logs?

Sure there is no backup/ snapshot running during the night who freezes or stops the database at this stage?

/KNEBB

2 Likes

Hmm. Just looked in the logs and I back up the MariaDB database nightly - once locally and once off-site. It would be logical to assume the DB process is halted in order to back it up. If this is the case, is it possible to stop ownCloud from generating these error messages, or at least stop them being saved in my data folder?

You could try to put it in maintenance mode temporarily, by cron for example. But I don’t know if this is sufficient.

1 Like

I just ran my backup manually and then checked the error log in my data folder. It was exactly the same as the previous overnight error logs. Synology says that when the MariaDB is backed up, it will be halted during the process. Thank you @knebb!

Thank you @alfredb. I am not so concerned now I know what the problem was. If necessary I can manually clear out the log files every so often. It would be nice to have a way of supressing them though. I will keep checking here, and do some digging.

Sorted! I simply changed the log settings to ‘Errors and Fatal Issues’ and now thge offending logs are not generated.

Yeah, but this is IMHO not a solution. Its still there, even if you no longer see it… But of course it’s your decision.

@alfredb Yes, that’s why I didn’t mark my post as a ‘solution’. Backing up a MariaDB database is bound to cause it to be halted while the backup occurs. ownCloud is bound to see this as an issue when it can’t connect to the halted database. Surely others have unattended backups happening where ownCloud complains? If there is an official solution I’ll implement it, but in the meantime I won’t see the warning messages!

1 Like

Well, there is an (more or less) official solution:

Put OC in maintenance mode before stopping the database.

Every backup programm has the possibility to add a “pre/post script”. So pre backup let the script put oc in maintenance mode and after backup switch into normal operation mode.

Thus, any database access will not cause any issues for oc. No matter if you see them in the logs or not.

/KNEBB

2 Likes

@knebb Thank you. There isn’t a way to add a pre or post script to Synology Hyperbackup tasks, so I have scheduled a task to run a couple of minutes before each backup to put ownCloud into maintenance mode, then 15 minutes later another task switches maintenance mode off. Given the backup of MariaDB only takes a few minutes this should be enough time. It feels a bit of a kludge, but it will do what is required and automatically too. Do you think it sounds reasonable?

Sounds good for me, yes. Not perfect but for sure good enough. And ways better then letting OC complain…

1 Like

Great, this would also be my way.

1 Like

Just to report back, last night’s backups went perfectly - ownCloud put into maintenance mode, Synology backup, then maintenance mode switched off. All without any user intervention AND no error messages! Thanks for your help @alfredb and @knebb.

1 Like