Background cron jobs failing at regular intervals after v. 25.0.1

Nextcloud version: 25.0.1
Operating system and version: Ubuntu 20.04.5 LTS (focal)
Apache: 2.4.41
PHP version: php-fpm 7.4.3

I run background jobs with a systemd timer and service file. They have been working fine for years. After the upgrade to Nextcloud 25.0.1 the nextcloudcron.service enters a failed state exactly two times a day at regular intervals. It is successful on its other runs as it runs every 5 minutes.
You can see the timing between fails in these log entries:

Nov 26 15:11:08 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 27 03:11:14 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 27 15:11:19 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 28 03:11:24 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 28 15:11:30 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 29 03:11:35 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Nov 29 15:11:40 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.

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

Steps to replicate it:

  1. Just run the cron job repeatedly.

Here are the failed journalctl logs for nextcloudcron.service

Dec 03 03:12:18 server systemd[1]: Started Nextcloud cron.php job.
Dec 03 03:12:18 server php[1070503]: Error: Typed property OCP\BackgroundJob\Job::$time must not be accessed before initialization in /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php:102
Dec 03 03:12:18 server php[1070503]: Stack trace:
Dec 03 03:12:18 server php[1070503]: #0 /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php(93): OCP\BackgroundJob\TimedJob->start(Object(OC\BackgroundJob\JobList))
Dec 03 03:12:18 server php[1070503]: #1 /var/www/nextcloud/cron.php(152): OCP\BackgroundJob\TimedJob->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
Dec 03 03:12:18 server php[1070503]: #2 {main}
Dec 03 03:12:18 server systemd[1]: nextcloudcron.service: Main process exited, code=exited, status=1/FAILURE
Dec 03 03:12:18 server systemd[1]: nextcloudcron.service: Failed with result 'exit-code'.
Dec 03 03:12:18 server systemd[1]: nextcloudcron.service: Consumed 129ms CPU time, received 206B IP traffic, sent 134B IP traffic.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"BtidEGH8Ij04895v6GR5","level":3,"time":"2022-12-03T03:12:18-05:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Typed property OCP\\BackgroundJob\\Job::$time must not be accessed before initialization","userAgent":"--","version":"25.0.1.1","exception":{"Exception":"Error","Message":"Typed property OCP\\BackgroundJob\\Job::$time must not be accessed before initialization","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"}]},{"file":"/var/www/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[{"__class__":"OC\\BackgroundJob\\JobList"},{"__class__":"OC\\Log"}]}],"File":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","Line":102,"CustomMessage":"--"},"id":"5960f8503k7r0"}
[cron] Error: Error: Typed property OCP\BackgroundJob\Job::$time must not be accessed before initialization at <<closure>>

0. /var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php line 93
   OCP\BackgroundJob\TimedJob->start(OC\BackgroundJob\JobList {})
1. /var/www/nextcloud/cron.php line 152
   OCP\BackgroundJob\TimedJob->execute(OC\BackgroundJob\JobList {}, OC\Log {})

at 2022-12-03T03:12:18-05:00

The output of your Apache/nginx/system log in: No errors in Apache log or php-fpm log.

same here

version":“25.0.1.1”,“exception”:{“Exception”:“Error”,“Message”:“Typed property OCP\BackgroundJob\Job::$time must not be accessed before initialization”,“Code”:0,“Trace”:[{“file”:“/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php”,“line”:93,“function”:“start”,“class”:“OCP\BackgroundJob\TimedJob”,“type”:“->”},{“file”:“/var/www/nextcloud/cron.php”,“line”:152,“function”:“execute”,“class”:“OCP\BackgroundJob\TimedJob”,“type”:“->”}],“File”:“/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php”,“Line”:102,“CustomMessage”:“–”}}

see Github – > LINK

LINK

seems that this is releated to a problem with the anti virus app
so lets see if it gets fixed with an update of the anti virus app

br

hello!
NC 28.0.2 , docker
See this:

2024-02-23T02:20:01.418631023Z Error: Typed property OCP\BackgroundJob\Job::$time must not be accessed before initialization in /var/www/html/lib/public/BackgroundJob/TimedJob.php:101
2024-02-23T02:20:01.418765394Z Stack trace:
2024-02-23T02:20:01.418864825Z #0 /var/www/html/lib/public/BackgroundJob/TimedJob.php(92): OCP\BackgroundJob\TimedJob->start(Object(OC\BackgroundJob\JobList))
2024-02-23T02:20:01.418910536Z #1 /var/www/html/cron.php(152): OCP\BackgroundJob\TimedJob->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
2024-02-23T02:20:01.418940606Z #2 {main}
2024-02-23T02:25:00.429739104Z crond: USER www-data pid 231 cmd php -f /var/www/html/cron.php
2024-02-23T02:25:01.082582640Z Error: Typed property OCP\BackgroundJob\Job::$time must not be accessed before initialization in /var/www/html/lib/public/BackgroundJob/TimedJob.php:101
2024-02-23T02:25:01.082766572Z Stack trace:
2024-02-23T02:25:01.082828593Z #0 /var/www/html/lib/public/BackgroundJob/TimedJob.php(92): OCP\BackgroundJob\TimedJob->start(Object(OC\BackgroundJob\JobList))
2024-02-23T02:25:01.082897873Z #1 /var/www/html/cron.php(152): OCP\BackgroundJob\TimedJob->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
2024-02-23T02:25:01.082944964Z #2 {main}

result of “occ background-job:list --limit=100” :

https://synology.monoboy.ru/sharing/SKJOXh2ub
| id  | class                                                           | last_run                  | argument        |
+-----+-----------------------------------------------------------------+---------------------------+-----------------+
| 1   | OCA\Activity\BackgroundJob\EmailNotification                    | 2024-02-26T06:25:35+00:00 | null            |
| 2   | OCA\Activity\BackgroundJob\ExpireActivities                     | 2024-02-26T01:30:58+00:00 | null            |
| 3   | OCA\Activity\BackgroundJob\DigestMail                           | 2024-02-26T05:50:20+00:00 | null            |
| 4   | OCA\Circles\Cron\Maintenance                                    | 2024-02-26T06:25:03+00:00 | null            |
| 5   | OCA\ContactsInteraction\BackgroundJob\CleanupJob                | 2024-02-26T01:45:51+00:00 | null            |
| 6   | OCA\DAV\BackgroundJob\CleanupDirectLinksJob                     | 2024-02-26T01:40:03+00:00 | null            |
| 7   | OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob | 2024-02-26T05:45:31+00:00 | null            |
| 8   | OCA\DAV\BackgroundJob\CleanupInvitationTokenJob                 | 2024-02-26T01:35:04+00:00 | null            |
| 9   | OCA\DAV\BackgroundJob\EventReminderJob                          | 2024-02-26T06:25:36+00:00 | null            |
| 10  | OCA\DAV\BackgroundJob\CalendarRetentionJob                      | 2024-02-26T03:05:12+00:00 | null            |
| 11  | OCA\DAV\BackgroundJob\PruneOutdatedSyncTokensJob                | 2024-02-26T01:35:06+00:00 | null            |
| 12  | OCA\Federation\SyncJob                                          | 2024-02-25T19:20:42+00:00 | null            |
| 13  | OCA\Files\BackgroundJob\ScanFiles                               | 2024-02-26T06:25:07+00:00 | null            |
| 14  | OCA\Files\BackgroundJob\DeleteOrphanedItems                     | 2024-02-26T06:20:12+00:00 | null            |
| 15  | OCA\Files\BackgroundJob\CleanupFileLocks                        | 2024-02-26T06:25:13+00:00 | null            |
| 16  | OCA\Files\BackgroundJob\CleanupDirectEditingTokens              | 2024-02-26T06:10:25+00:00 | null            |
| 17  | OCA\Files\BackgroundJob\DeleteExpiredOpenLocalEditor            | 2024-02-26T01:00:13+00:00 | null            |
| 18  | OCA\FilesReminders\BackgroundJob\CleanUpReminders               | 2024-02-26T01:35:09+00:00 | null            |
| 19  | OCA\FilesReminders\BackgroundJob\ScheduledNotifications         | 2024-02-26T06:25:26+00:00 | null            |
| 20  | OCA\Files_Sharing\DeleteOrphanedSharesJob                       | 2024-02-26T06:25:33+00:00 | null            |
| 21  | OCA\Files_Sharing\ExpireSharesJob                               | 2024-02-26T01:50:08+00:00 | null            |
| 22  | OCA\Files_Sharing\BackgroundJob\FederatedSharesDiscoverJob      | 2024-02-25T19:26:12+00:00 | null            |
| 23  | OCA\Files_Trashbin\BackgroundJob\ExpireTrash                    | 2024-02-26T05:55:30+00:00 | null            |
| 24  | OCA\Files_Versions\BackgroundJob\ExpireVersions                 | 2024-02-26T06:05:20+00:00 | null            |
| 25  | OCA\NextcloudAnnouncements\Cron\Crawler                         | 2024-02-25T23:00:43+00:00 | null            |
| 26  | OCA\Notifications\BackgroundJob\GenerateUserSettings            | 2024-02-25T19:20:49+00:00 | null            |
| 27  | OCA\Notifications\BackgroundJob\SendNotificationMails           | 2024-02-26T06:25:20+00:00 | null            |
| 28  | OCA\OAuth2\BackgroundJob\CleanupExpiredAuthorizationCode        | 2024-01-31T14:40:49+00:00 | null            |
| 29  | OCA\Photos\Jobs\AutomaticPlaceMapperJob                         | 2024-02-26T01:25:46+00:00 | null            |
| 30  | OCA\ServerInfo\Jobs\UpdateStorageStats                          | 2024-02-26T03:50:02+00:00 | null            |
| 31  | OCA\Support\BackgroundJobs\CheckSubscription                    | 2024-02-26T06:25:23+00:00 | null            |
| 32  | OCA\Text\Cron\Cleanup                                           | 2024-02-26T06:25:23+00:00 | null            |
| 33  | OCA\UpdateNotification\Notification\BackgroundJob               | 2024-02-25T19:25:09+00:00 | null            |
| 34  | OCA\UserStatus\BackgroundJob\ClearOldStatusesBackgroundJob      | 2024-02-26T06:25:24+00:00 | null            |
| 35  | OCA\WorkflowEngine\BackgroundJobs\Rotate                        | 2024-02-26T03:50:10+00:00 | null            |
| 36  | OC\Authentication\Token\TokenCleanupJob                         | 2024-02-26T01:25:49+00:00 | null            |
| 37  | OC\Log\Rotate                                                   | 2024-02-26T06:25:30+00:00 | null            |
| 38  | OC\Preview\BackgroundCleanupJob                                 | 2024-02-26T06:00:03+00:00 | null            |
| 39  | OC\TextProcessing\RemoveOldTasksBackgroundJob                   | 2024-02-25T19:20:26+00:00 | null            |
| 52  | OCA\Files_External\BackgroundJob\CredentialsCleanup             | 2024-02-26T01:25:50+00:00 | null            |
| 53  | OCA\SuspiciousLogin\BackgroundJob\ETLJob                        | 2024-02-26T05:55:42+00:00 | null            |
| 54  | OCA\SuspiciousLogin\BackgroundJob\TrainJobIpV4                  | 2024-02-26T01:25:51+00:00 | null            |
| 55  | OCA\SuspiciousLogin\BackgroundJob\TrainJobIpV6                  | 2024-02-26T01:30:00+00:00 | null            |
| 56  | OCA\Calendar\BackgroundJob\CleanUpOutdatedBookingsJob           | 2024-02-26T01:30:01+00:00 | null            |
| 57  | OCA\Contacts\Cron\SocialUpdateRegistration                      | 2024-02-20T01:00:20+00:00 | null            |
| 58  | OCA\Mail\BackgroundJob\CleanupJob                               | 2024-02-26T01:30:04+00:00 | null            |
| 59  | OCA\Mail\BackgroundJob\OutboxWorkerJob                          | 2024-02-26T06:25:29+00:00 | null            |
| 60  | OCA\Mail\BackgroundJob\IMipMessageJob                           | 2024-02-26T05:45:43+00:00 | null            |
| 61  | OCA\Mail\BackgroundJob\DraftsJob                                | 2024-02-26T06:25:06+00:00 | null            |
| 62  | OCA\Mail\BackgroundJob\TrashRetentionJob                        | 2024-02-26T01:30:06+00:00 | null            |
| 63  | OCA\Mail\BackgroundJob\WakeJob                                  | 2024-02-26T06:25:08+00:00 | null            |
| 66  | OCA\Talk\BackgroundJob\CheckHostedSignalingServer               | 2024-02-26T06:25:09+00:00 | null            |
| 67  | OCA\Talk\BackgroundJob\CheckMatterbridges                       | 2024-02-26T06:15:20+00:00 | null            |
| 70  | OCA\Talk\BackgroundJob\ExpireChatMessages                       | 2024-02-26T06:25:11+00:00 | null            |
| 71  | OCA\Talk\BackgroundJob\ExpireSignalingMessage                   | 2024-02-26T06:25:12+00:00 | null            |
| 72  | OCA\Talk\BackgroundJob\Reminder                                 | 2024-02-26T06:25:21+00:00 | null            |
| 73  | OCA\Talk\BackgroundJob\RemoveEmptyRooms                         | 2024-02-26T05:55:15+00:00 | null            |
| 74  | OCA\Talk\BackgroundJob\ResetAssignedSignalingServer             | 2024-02-26T06:25:31+00:00 | null            |
| 75  | OCA\Deck\Cron\DeleteCron                                        | 2024-02-26T01:30:08+00:00 | null            |
| 76  | OCA\Deck\Cron\ScheduledNotifications                            | 2024-02-26T06:25:32+00:00 | null            |
| 77  | OCA\Deck\Cron\CardDescriptionActivity                           | 2024-02-26T06:25:14+00:00 | null            |
| 78  | OCA\Deck\Cron\SessionsCleanup                                   | 2024-02-26T06:25:16+00:00 | null            |
| 89  | OCA\FullTextSearch\Cron\Index                                   | 2024-02-26T06:15:50+00:00 | null            |
| 90  | OCA\FullTextSearch\Cron\Maintenance                             | 2024-02-26T05:45:09+00:00 | null            |
| 141 | OCA\Mail\BackgroundJob\SyncJob                                  | 2024-02-26T05:55:08+00:00 | {"accountId":1} |
| 142 | OCA\Mail\BackgroundJob\TrainImportanceClassifierJob             | 2024-02-26T01:30:09+00:00 | {"accountId":1} |
| 143 | OCA\Mail\BackgroundJob\PreviewEnhancementProcessingJob          | 2024-02-26T05:45:19+00:00 | {"accountId":1} |
| 144 | OCA\Mail\BackgroundJob\QuotaJob                                 | 2024-02-22T01:05:34+00:00 | {"accountId":1} |
| 147 | OCA\DuplicateFinder\BackgroundJob\CleanUpDB                     | 1970-01-01T00:00:00+00:00 | null            |
| 148 | OCA\DuplicateFinder\BackgroundJob\FindDuplicates                | 1970-01-01T00:00:00+00:00 | null            |
| 169 | OC\Core\BackgroundJobs\CleanupLoginFlowV2                       | 2024-02-26T05:55:02+00:00 | null            |
| 170 | OC\Security\Bruteforce\CleanupJob                               | 2024-02-26T01:30:13+00:00 | null            |
| 172 | OC\TextToImage\RemoveOldTasksBackgroundJob                      | 2024-02-25T20:21:00+00:00 | null