NC 31/32 : Background Jobs are not completed

Nextcloud Server version: 32.0.2
OS: Ubuntu 22.04
Webserver: Apache 2.4.62-1+ubuntu22.04.1+deb.sury.org+1
PHP: 8.3.12 (PHP-FPM)

  • Is this the first time you’ve seen this error?

    Yes

  • When did this problem seem to first start?

    Unknown. I did not review the background jobs queue until now.

  • Installation method *

    Archive*

  • Are you using CloudfIare, mod_security, or similar? *

    No*

Summary of the issue you are facing:

Background jobs are not being completed. The Job Queue of nextcloud is never empty:

output of sudo -u www-data php occ background-job:list

https://nopaste.net/Wref34kNQQ

Steps to replicate it (hint: details matter!):

  1. review job queue: sudo -u www-data php occ background-job:list (→ 77 Jobs)

  2. trying to run background-jobs: sudo -u www-data php occ background-job:worker (→ infinite loop)

    command Output: https://nopaste.net/sYgFQjDoaL

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

Lots of output

https://nopaste.net/cbPoT7X3mr

Web server / Reverse Proxy

The output of your Apache /var/log/access.log (seems to contain nothing relevant).

https://nopaste.net/H81mWKlAAJ

Configuration

Nextcloud

sudo -u www-data php occ config:list system| sed -r -e 's/realdomain/mydomain.com/'
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "mydomain.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "32.0.2.2",
        "overwrite.cli.url": "https:\/\/mydomain.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "default_phone_region": "DE",
        "loglevel": 0,
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "trashbin_retention_obligation": "30, 35",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "6379",
            "timeout": "0",
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "maintenance_window_start": 1,
        "app_install_overwrite": [
            "dashboardcharts"
        ]
    }
}

Apps

sudo -u www-data php occ app:list 

Enabled: 
  - activity: 5.0.0-dev.0 
  - bruteforcesettings: 5.0.0-dev.0 
  - calendar: 6.1.1 
  - circles: 32.0.0 
  - cloud_federation_api: 1.16.0 
  - comments: 1.22.0 
  - contacts: 8.1.1 
  - contactsinteraction: 1.13.1 
  - dav: 1.34.2 
  - federatedfilesharing: 1.22.0 
  - federation: 1.22.0 
  - files: 2.4.0 
  - files_downloadlimit: 5.0.0-dev.0 
  - files_pdfviewer: 5.0.0-dev.0 
  - files_reminders: 1.5.0 
  - files_sharing: 1.24.1 
  - files_trashbin: 1.22.0 
  - files_versions: 1.25.0 
  - firstrunwizard: 5.0.0-dev.0 
  - logreader: 5.0.0-dev.0 
  - lookup_server_connector: 1.20.0 
  - mail: 5.6.2 
  - nextcloud_announcements: 4.0.0-dev.0 
  - notes: 4.12.4 
  - notifications: 5.0.0-dev.0 
  - oauth2: 1.20.0 
  - password_policy: 4.0.0-dev.0 
  - photos: 5.0.0-dev.1 
  - polls: 8.5.0 
  - privacy: 4.0.0-dev.0 
  - profile: 1.1.0 
  - provisioning_api: 1.22.0 
  - recommendations: 5.0.0-dev.0 
  - registration: 2.8.0 
  - serverinfo: 4.0.0-dev.0 
  - settings: 1.15.1 
  - sharebymail: 1.22.0 
  - spreed: 22.0.4 
  - support: 4.0.0-dev.0 
  - survey_client: 4.0.0-dev.0 
  - systemtags: 1.22.0 
  - tasks: 0.17.1 
  - text: 6.0.1 
  - theming: 2.7.0 
  - timetracker: 0.0.86 
  - twofactor_backupcodes: 1.21.0 
  - updatenotification: 1.22.0 
  - user_status: 1.12.0 
  - viewer: 5.0.0-dev.0 
  - weather_status: 1.12.0 
  - webhook_listeners: 1.3.0 
  - workflowengine: 2.14.0 
Disabled: 
  - admin_audit: 1.22.0 
  - app_api: 32.0.0 (installed 5.0.2) 
  - collectives: 3.4.0 (installed 3.4.0) 
  - dashboard: 7.12.0 (installed 7.0.0) 
  - deck: 1.16.2 (installed 1.16.2) 
  - encryption: 2.20.0 
  - files_external: 1.24.0 
  - files_rightclick: 0.15.1 (installed 1.6.0) 
  - keeweb: 0.6.22 (installed 0.6.22) 
  - onlyoffice: 9.11.0 (installed 9.11.0) 
  - passwords: 2025.11.20 (installed 2025.11.20) 
  - related_resources: 3.0.0-dev.0 (installed 1.0.3) 
  - suspicious_login: 10.0.0-dev.0 
  - twofactor_nextcloud_notification: 6.0.0-dev.0 
  - twofactor_totp: 14.0.0 
  - user_ldap: 1.23.0

I’m unclear what you’re concerned about here.

There will always be background jobs; they’re how the system operates.

The worker mode is a special way of running background jobs instead of cron.

The extra output is you’re seeing is mostly because you have your log level set to 0 (debug level).

Perhaps you can elaborate as to what problem you’re experiencing or what you’re trying to accomplish?

1 Like

Thanks jtr for your response.

My understanding of a job queue is, that there are jobs that will be run and then they are done, they are removed from the job queue. When all jobs are finished, the job queue will be empty for that moment until new jobs come in. Then the queue will be filled again and completed, for example by the nextcloud cron.

My understanding of the command occ background-job:worker is, that this call will explicitely execute, complete and remove all jobs in the background-job queue.

Is my understanding wrong here?

When my understanding is right here, jobs get never completed fully or successfully, which I assume to be a problem in the nextcloud instance.

I’m no expert, so please anyone correct me if I’m wrong, but from what I understand, background-job:list simply lists all background jobs that exist in Nextcloud and shows when they last ran. So, no. I don’t think they should ever disappear from that list.

With background-job:worker, you can run induvidual jobs manually or, I guess, you could use it to build your own custom cron script if, for whatever reason, you don’t want to use the default schedules that are hard-coded into Nextcloud (which I wouldn’t recommend unless you really know what you’re doing and why you’re doing it).

I would recommend simply setting up a cron job or systemd timer that runs cron.php every five minutes and letting Nextcloud handle the jobs automatically, rather than manually running individual jobs (again, unless you have a very specific reason to do so).

1 Like

“Background jobs” in Nextcloud is an umbrella term that covers a mixture of different job types. One type is queued jobs, but there are other types. It’s unlikely you’d ever see the queue empty (outside of a broken system) since at a minimum there will be a mixture of queued, scheduled, and recurring jobs always there.

Your undesrstand is wrong here. The list produced by occ background-job:list is not a queue. This is the list of all background jobs which will run at some point and the time when the job was run the last time.

What jobs you will see in the list depends on which apps you have installed. Many apps add their own background jobs and all jobs are stored in the database. You should also not delete them, otherwise some regular maintenance will not be done.

1 Like

Thanks! I hoped for a statement with that clarity. Request solved!

I also restored all the records for oc_jobs Table from a database backup, because I deleted those records, because of thinking that jobs should be cleaned up.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.