Any clue on /var/opt/rh/rh-php72/log/php-fpm/error.log
?
Here is the error log:
[01-Sep-2019 14:09:55] NOTICE: error log file re-opened
[01-Sep-2019 22:16:35] NOTICE: Terminating …
[01-Sep-2019 22:16:35] NOTICE: exiting, bye-bye!
[02-Sep-2019 07:50:08] NOTICE: fpm is running, pid 1541
[02-Sep-2019 07:50:08] NOTICE: ready to handle connections
[02-Sep-2019 07:50:08] NOTICE: systemd monitor interval set to 10000ms
[02-Sep-2019 22:00:35] NOTICE: Terminating …
[02-Sep-2019 22:00:35] NOTICE: exiting, bye-bye!
[03-Sep-2019 07:50:20] NOTICE: fpm is running, pid 1537
[03-Sep-2019 07:50:20] NOTICE: ready to handle connections
[03-Sep-2019 07:50:20] NOTICE: systemd monitor interval set to 10000ms
[03-Sep-2019 17:17:51] NOTICE: Terminating …
[03-Sep-2019 17:17:51] NOTICE: exiting, bye-bye!
[03-Sep-2019 17:17:51] NOTICE: fpm is running, pid 17245
[03-Sep-2019 17:17:51] NOTICE: ready to handle connections
[03-Sep-2019 17:17:51] NOTICE: systemd monitor interval set to 10000ms
[03-Sep-2019 17:18:36] NOTICE: Terminating …
[03-Sep-2019 17:18:36] NOTICE: exiting, bye-bye!
[03-Sep-2019 17:20:29] NOTICE: fpm is running, pid 1531
[03-Sep-2019 17:20:29] NOTICE: ready to handle connections
[03-Sep-2019 17:20:29] NOTICE: systemd monitor interval set to 10000ms
[03-Sep-2019 21:49:40] NOTICE: Terminating …
[03-Sep-2019 21:49:40] NOTICE: exiting, bye-bye!
[04-Sep-2019 07:50:42] NOTICE: fpm is running, pid 1538
[04-Sep-2019 07:50:42] NOTICE: ready to handle connections
[04-Sep-2019 07:50:42] NOTICE: systemd monitor interval set to 10000ms
[04-Sep-2019 21:20:29] NOTICE: Terminating …
[04-Sep-2019 21:20:29] NOTICE: exiting, bye-bye!
[05-Sep-2019 07:50:06] NOTICE: fpm is running, pid 1537
[05-Sep-2019 07:50:06] NOTICE: ready to handle connections
[05-Sep-2019 07:50:06] NOTICE: systemd monitor interval set to 10000ms
[05-Sep-2019 22:07:12] NOTICE: Terminating …
[05-Sep-2019 22:07:12] NOTICE: exiting, bye-bye!
[06-Sep-2019 07:50:08] NOTICE: fpm is running, pid 1535
[06-Sep-2019 07:50:08] NOTICE: ready to handle connections
[06-Sep-2019 07:50:08] NOTICE: systemd monitor interval set to 10000ms
[06-Sep-2019 21:17:48] NOTICE: Terminating …
[06-Sep-2019 21:17:48] NOTICE: exiting, bye-bye!
[07-Sep-2019 07:50:26] NOTICE: fpm is running, pid 1539
[07-Sep-2019 07:50:26] NOTICE: ready to handle connections
[07-Sep-2019 07:50:26] NOTICE: systemd monitor interval set to 10000ms
My bad, nothing useful on that log.
I kind of reproduced the problem:
forcing nextcloud cron job to execute when mysql is not running
[root@server ~]# systemctl stop mysqld
[root@server ~]# sudo -u apache scl enable rh-php72 -- php -dmemory_limit=512M -f /usr/share/nextcloud/cron.php
PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/share/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /usr/share/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(181): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMyS in /usr/share/nextcloud/lib/private/DB/Connection.php on line 64
PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory in /usr/share/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(448): OC\DB\Connection->connect()
#1 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(410): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(354): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(710): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /usr/share/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /usr/share/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(181): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMyS in /usr/share/nextcloud/lib/private/DB/Connection.php on line 64
So an explanation or sequence of events could be that:
- mysqld service was stopped or restarting
- then, the nextcloud cron job ran
- cron.php failed to connect to mysql’s unix socket
- cron job failed and mailed the error
- after that, mysqld service was back online, no more errors and nextcloud still works
My Nethserver restarts every morning at 07:45. The mail with the error message came at 07:50.
I think it’s because the restart and cron job are temporally together. Could that be a possibility?
Yes, that plausible, according to mariadb/mysqld service:
Just compare the timing between the cron job execution and mariadb/mysqld service start.
Is it possible to terminate the cron job to a later time?
The nextcloud cron job is set to run every 5 minutes. I don’t see the need to change it, if our findings are correct the message can be ignored.
Ok, thanks to you and all the other helpers.
Regards
Uwe