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:
- 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.