[core] Error: Error while running background job (UpdateAvailableNotifications)

I have this error in my syslog once every day:

[core] Error: Error while running background job OCA\UpdateNotification\BackgroundJob\UpdateAvailableNotifications (id: 8224, arguments: null)
	from ? by -- at 04.02.2025, 06:12:29

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Nextcloud Hub 9 (30.0.5)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12.9
  • Web server and version (e.g, Apache 2.4.25):
    • apache2 2.4.62-1+0~20240722.6+debian12~1.gbp3f781d
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx 1.27.3-1~bookworm
  • PHP version (e.g, 8.3):
    • 8.2
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • -
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Can you provide the full log message? Without the stack trace we can’t do more than guess.

Any chance you disabled the updatenotification app?

updatenotification app disabled? Don’t think so, see screenshot

Does this error message help? (otherwise how can I get an even better strack trace?)

{
    "reqId": "YQWKZloM5EqzyGQMibaT",
    "level": 3,
    "time": "2025-02-05T05:11:18+00:00",
    "remoteAddr": "",
    "user": "--",
    "app": "core",
    "method": "",
    "url": "--",
    "message": "Error while running background job OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications (id: 8224, arguments: null)",
    "userAgent": "--",
    "version": "30.0.5.1",
    "exception":
    {
        "Exception": "OC\\DB\\Exceptions\\DbalException",
        "Message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away",
        "Code": 2006,
        "Trace":
        [
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/ConnectionAdapter.php",
                "line": 69,
                "function": "wrap",
                "class": "OC\\DB\\Exceptions\\DbalException",
                "type": "::"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/QueryBuilder/QueryBuilder.php",
                "line": 306,
                "function": "executeStatement",
                "class": "OC\\DB\\ConnectionAdapter",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                "line": 816,
                "function": "executeStatement",
                "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                "line": 596,
                "function": "setTypedValue",
                "class": "OC\\AppConfig",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/Updater/VersionCheck.php",
                "line": 48,
                "function": "setValueInt",
                "class": "OC\\AppConfig",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                "line": 73,
                "function": "check",
                "class": "OC\\Updater\\VersionCheck",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                "line": 60,
                "function": "checkCoreUpdate",
                "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/Job.php",
                "line": 61,
                "function": "run",
                "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                "line": 88,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                "line": 75,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->"
            },
            {
                "file": "/home/panel/web/cloud.panel.de/public_html/cron.php",
                "line": 162,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->"
            }
        ],
        "File": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/Exceptions/DbalException.php",
        "Line": 54,
        "Previous":
        {
            "Exception": "Doctrine\\DBAL\\Exception\\ConnectionLost",
            "Message": "An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away",
            "Code": 2006,
            "Trace":
            [
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1939,
                    "function": "convert",
                    "class": "Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1881,
                    "function": "handleDriverException",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connection.php",
                    "line": 1213,
                    "function": "convertExceptionDuringQuery",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                    "line": 292,
                    "function": "executeStatement",
                    "class": "Doctrine\\DBAL\\Connection",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/Connection.php",
                    "line": 462,
                    "function": "executeStatement",
                    "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/ConnectionAdapter.php",
                    "line": 67,
                    "function": "executeStatement",
                    "class": "OC\\DB\\Connection",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/QueryBuilder/QueryBuilder.php",
                    "line": 306,
                    "function": "executeStatement",
                    "class": "OC\\DB\\ConnectionAdapter",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                    "line": 816,
                    "function": "executeStatement",
                    "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                    "line": 596,
                    "function": "setTypedValue",
                    "class": "OC\\AppConfig",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/Updater/VersionCheck.php",
                    "line": 48,
                    "function": "setValueInt",
                    "class": "OC\\AppConfig",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                    "line": 73,
                    "function": "check",
                    "class": "OC\\Updater\\VersionCheck",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                    "line": 60,
                    "function": "checkCoreUpdate",
                    "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/Job.php",
                    "line": 61,
                    "function": "run",
                    "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                    "line": 88,
                    "function": "start",
                    "class": "OCP\\BackgroundJob\\Job",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                    "line": 75,
                    "function": "start",
                    "class": "OCP\\BackgroundJob\\TimedJob",
                    "type": "->"
                },
                {
                    "file": "/home/panel/web/cloud.panel.de/public_html/cron.php",
                    "line": 162,
                    "function": "execute",
                    "class": "OCP\\BackgroundJob\\TimedJob",
                    "type": "->"
                }
            ],
            "File": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php",
            "Line": 105,
            "Previous":
            {
                "Exception": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
                "Message": "SQLSTATE[HY000]: General error: 2006 MySQL server has gone away",
                "Code": 2006,
                "Trace":
                [
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                        "line": 132,
                        "function": "new",
                        "class": "Doctrine\\DBAL\\Driver\\PDO\\Exception",
                        "type": "::"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connection.php",
                        "line": 1207,
                        "function": "execute",
                        "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                        "line": 292,
                        "function": "executeStatement",
                        "class": "Doctrine\\DBAL\\Connection",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/Connection.php",
                        "line": 462,
                        "function": "executeStatement",
                        "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/ConnectionAdapter.php",
                        "line": 67,
                        "function": "executeStatement",
                        "class": "OC\\DB\\Connection",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/QueryBuilder/QueryBuilder.php",
                        "line": 306,
                        "function": "executeStatement",
                        "class": "OC\\DB\\ConnectionAdapter",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                        "line": 816,
                        "function": "executeStatement",
                        "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                        "line": 596,
                        "function": "setTypedValue",
                        "class": "OC\\AppConfig",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/Updater/VersionCheck.php",
                        "line": 48,
                        "function": "setValueInt",
                        "class": "OC\\AppConfig",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                        "line": 73,
                        "function": "check",
                        "class": "OC\\Updater\\VersionCheck",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                        "line": 60,
                        "function": "checkCoreUpdate",
                        "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/Job.php",
                        "line": 61,
                        "function": "run",
                        "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                        "line": 88,
                        "function": "start",
                        "class": "OCP\\BackgroundJob\\Job",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                        "line": 75,
                        "function": "start",
                        "class": "OCP\\BackgroundJob\\TimedJob",
                        "type": "->"
                    },
                    {
                        "file": "/home/panel/web/cloud.panel.de/public_html/cron.php",
                        "line": 162,
                        "function": "execute",
                        "class": "OCP\\BackgroundJob\\TimedJob",
                        "type": "->"
                    }
                ],
                "File": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php",
                "Line": 28,
                "Previous":
                {
                    "Exception": "PDOException",
                    "Message": "SQLSTATE[HY000]: General error: 2006 MySQL server has gone away",
                    "Code": "HY000",
                    "Trace":
                    [
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                            "line": 130,
                            "function": "execute",
                            "class": "PDOStatement",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connection.php",
                            "line": 1207,
                            "function": "execute",
                            "class": "Doctrine\\DBAL\\Driver\\PDO\\Statement",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php",
                            "line": 292,
                            "function": "executeStatement",
                            "class": "Doctrine\\DBAL\\Connection",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/Connection.php",
                            "line": 462,
                            "function": "executeStatement",
                            "class": "Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/ConnectionAdapter.php",
                            "line": 67,
                            "function": "executeStatement",
                            "class": "OC\\DB\\Connection",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/DB/QueryBuilder/QueryBuilder.php",
                            "line": 306,
                            "function": "executeStatement",
                            "class": "OC\\DB\\ConnectionAdapter",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                            "line": 816,
                            "function": "executeStatement",
                            "class": "OC\\DB\\QueryBuilder\\QueryBuilder",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/AppConfig.php",
                            "line": 596,
                            "function": "setTypedValue",
                            "class": "OC\\AppConfig",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/private/Updater/VersionCheck.php",
                            "line": 48,
                            "function": "setValueInt",
                            "class": "OC\\AppConfig",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                            "line": 73,
                            "function": "check",
                            "class": "OC\\Updater\\VersionCheck",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php",
                            "line": 60,
                            "function": "checkCoreUpdate",
                            "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/Job.php",
                            "line": 61,
                            "function": "run",
                            "class": "OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                            "line": 88,
                            "function": "start",
                            "class": "OCP\\BackgroundJob\\Job",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/lib/public/BackgroundJob/TimedJob.php",
                            "line": 75,
                            "function": "start",
                            "class": "OCP\\BackgroundJob\\TimedJob",
                            "type": "->"
                        },
                        {
                            "file": "/home/panel/web/cloud.panel.de/public_html/cron.php",
                            "line": 162,
                            "function": "execute",
                            "class": "OCP\\BackgroundJob\\TimedJob",
                            "type": "->"
                        }
                    ],
                    "File": "/home/panel/web/cloud.panel.de/public_html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php",
                    "Line": 130
                }
            }
        },
        "message": "Error while running background job OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications (id: 8224, arguments: null)",
        "exception":
        [],
        "CustomMessage": "Error while running background job OCA\\UpdateNotification\\BackgroundJob\\UpdateAvailableNotifications (id: 8224, arguments: null)"
    },
    "id": "67a465b8079d5"
}

For me this sounds like the connection to your DB server has been lost.

I also would interpret that my mysql server crashed at that time - but this must be the case nearly every day then :thinking:

(and I can’t see these crashes in the mysql logs - have to check these mysql logs the next days)

Due to the fact that it is happening when a background job is executed and not in general when you are accessing Nextcloud, it might be worth to check the PHP CLI configuration. You need to make sure that you can connect to the DB from the command line too.