Skip to content

[Bug]: occ versions:expire doesn't work on NC 26 #37527

@enoch85

Description

@enoch85

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

It was supposed to be fixed with this PR but it's still happening on a newly updated NC 26 instance.

Cron doesn't behave as it should.

cc @artonge

Steps to reproduce

  1. Run occ versions:expire -vvv
  2. Get a stack trace

Expected behavior

Everything should work.

Installation method

Community Manual installation with Archive

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "192.168.1.64",
            "domain.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "26.0.0.11",
        "overwrite.cli.url": "https:\/\/domain.com\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "loglevel": "2",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "mail_smtpmode": "smtp",
        "remember_login_cookie_lifetime": "1800",
        "log_rotate_size": "10485760",
        "trashbin_retention_obligation": "auto, 60",
        "versions_retention_obligation": "auto, 180",
        "activity_expire_days": "120",
        "simpleSignUpLink.shown": false,
        "default_phone_region": "de",
        "logtimezone": "Europe\/Berlin",
        "htaccess.RewriteBase": "\/",
        "maintenance": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0.5,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Enabled:
  - activity: 2.18.0
  - admin_audit: 1.16.0
  - announcementcenter: 6.5.1
  - appointments: 1.14.13
  - bookmarks: 13.0.1
  - bruteforcesettings: 2.6.0
  - calendar: 4.3.1
  - circles: 26.0.0
  - cloud_federation_api: 1.9.0
  - collectives: 2.4.0
  - comments: 1.16.0
  - contacts: 5.2.0
  - contactsinteraction: 1.7.0
  - dashboard: 7.6.0
  - dav: 1.25.0
  - deck: 1.9.0
  - drawio: 2.1.0
  - external: 5.1.0
  - federatedfilesharing: 1.16.0
  - federation: 1.16.0
  - files: 1.21.1
  - files_accesscontrol: 1.16.0
  - files_automatedtagging: 1.16.1
  - files_downloadactivity: 1.16.0
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - forms: 3.2.0
  - groupfolders: 14.0.0
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - mail: 3.0.2
  - maps: 1.0.2
  - nextcloud_announcements: 1.15.0
  - notes: 4.7.2
  - notifications: 2.14.0
  - notify_push: 0.6.2
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - passwords: 2023.3.21
  - photos: 2.2.0
  - polls: 4.1.8
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - quota_warning: 1.16.0
  - recognize: 3.7.0
  - recommendations: 1.5.0
  - related_resources: 1.1.0-alpha1
  - richdocuments: 8.0.0
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - sharebymail: 1.16.0
  - side_menu: 3.7.2
  - spreed: 16.0.2
  - support: 1.9.0
  - survey_client: 1.14.0
  - systemtags: 1.16.0
  - tasks: 0.14.5
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_ldap: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - weather_status: 1.6.0
  - workflowengine: 2.8.0
Disabled:
  - emlviewer: 1.0.7 (installed 1.0.7)
  - encryption: 2.14.0
  - files_external: 1.18.0
  - files_linkeditor: 1.1.13 (installed 1.1.13)
  - files_mindmap: 0.0.27 (installed 0.0.27)
  - ransomware_protection: 1.14.0 (installed 1.14.0)
  - richdocumentscode: 22.5.802 (installed 22.5.802)
  - suspicious_login: 4.4.0 (installed 4.4.0)
  - twofactor_totp: 8.0.0-alpha.

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"lZv2M6sjWjTlp1uWCF4D","level":3,"time":"2023-03-31T22:55:13+02:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )","userAgent":"--","version":"26.0.0.11","exception":{"Exception":"OCP\\Files\\NotFoundException","Message":"/drseitner.admin/files/Personal/05 Personalakten/Besnik Karai/Zahntechniker.docx","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","line":139,"function":"get","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/nextcloud/apps/files_versions/lib/Storage.php","line":595,"function":"get","class":"OC\\Files\\Node\\Folder","type":"->"},{"function":"OCA\\Files_Versions\\{closure}","class":"OCA\\Files_Versions\\Storage","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/files_versions/lib/Storage.php","line":610,"function":"array_filter"},{"file":"/var/www/nextcloud/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":69,"function":"expireOlderThanMaxForUser","class":"OCA\\Files_Versions\\Storage","type":"::"},{"file":"/var/www/nextcloud/lib/private/User/Manager.php","line":639,"function":"OCA\\Files_Versions\\BackgroundJob\\{closure}","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/files_versions/lib/BackgroundJob/ExpireVersions.php","line":70,"function":"callForSeenUsers","class":"OC\\User\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":78,"function":"run","class":"OCA\\Files_Versions\\BackgroundJob\\ExpireVersions","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"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/private/Files/Node/Root.php","Line":209,"message":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )","exception":{},"CustomMessage":"Error while running background job (class: OCA\\Files_Versions\\BackgroundJob\\ExpireVersions, arguments: )"}}
OCP\AppFramework\Db\DoesNotExistException: Did expect one result but found none when executing: query "SELECT * FROM `*PREFIX*files_versions` WHERE (`file_id` = :dcValue1) AND (`timestamp` = :dcValue2)";

    /var/www/nextcloud/lib/public/AppFramework/Db/QBMapper.php - line 361:

    OCP\AppFramework\Db\QBMapper->findOneQuery()

    /var/www/nextcloud/apps/files_versions/lib/Db/VersionsMapper.php - line 78:

    OCP\AppFramework\Db\QBMapper->findEntity()

    /var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php - line 242:

    OCA\Files_Versions\Db\VersionsMapper->findVersionForFileId()

    /var/www/nextcloud/apps/files_versions/lib/Listener/FileEventsListener.php - line 106:

    OCA\Files_Versions\Listener\FileEventsListener->post_write_hook()

    /var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php - line 86:

    OCA\Files_Versions\Listener\FileEventsListener->handle()

    /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php - line 251:

    OC\EventDispatcher\ServiceEventListener->__invoke()

    /var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php - line 73:

    Symfony\Component\EventDispatcher\EventDispatcher->callListeners()

    /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php - line 87:

    Symfony\Component\EventDispatcher\EventDispatcher->dispatch()

    /var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php - line 99:

    OC\EventDispatcher\EventDispatcher->dispatch()

    /var/www/nextcloud/lib/private/Files/Node/HookConnector.php - line 118:

    OC\EventDispatcher\EventDispatcher->dispatchTyped()

    /var/www/nextcloud/lib/private/legacy/OC_Hook.php - line 105:

    OC\Files\Node\HookConnector->postWrite()

    /var/www/nextcloud/lib/private/Files/View.php - line 643:

    OC_Hook::emit()

    /var/www/nextcloud/lib/private/Files/View.php - line 694:

    OC\Files\View->emit_file_hooks_post()

    /var/www/nextcloud/lib/private/Files/Node/File.php - line 71:

    OC\Files\View->file_put_contents()

    /var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php - line 503:

    OC\Files\Node\File->putContent()

    /var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php - line 785:

    OCA\Richdocuments\Controller\WopiController->OCA\Richdocuments\Controller\{closure}("*** sensiti ... *")

    /var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php - line 762:

    OCA\Richdocuments\Controller\WopiController->retryOperation()

    /var/www/nextcloud/lib/private/Files/Lock/LockManager.php - line 29:

    OCA\Richdocuments\Controller\WopiController->OCA\Richdocuments\Controller\{closure}("*** sensiti ... *")

    /var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php - line 765:

    OC\Files\Lock\LockManager->runInScope()

    /var/www/nextcloud/apps/richdocuments/lib/Controller/WopiController.php - line 504:

    OCA\Richdocuments\Controller\WopiController->wrappedFilesystemOperation()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 230:

    OCA\Richdocuments\Controller\WopiController->putFile()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 137:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 183:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 315:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 1055:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 36:

    OC::handleRequest()

Additional info

When running occ versions:expire -vvv

Exception trace:
  at /var/www/nextcloud/lib/private/Files/Node/Root.php:209
 OC\Files\Node\Root->get() at /var/www/nextcloud/lib/private/Files/Node/Folder.php:139
 OC\Files\Node\Folder->get() at /var/www/nextcloud/apps/files_versions/lib/Storage.php:595
 OCA\Files_Versions\Storage::OCA\Files_Versions\{closure}() at n/a:n/a
 array_filter() at /var/www/nextcloud/apps/files_versions/lib/Storage.php:610
 OCA\Files_Versions\Storage::expireOlderThanMaxForUser() at /var/www/nextcloud/apps/files_versions/lib/Command/ExpireVersions.php:110
 OCA\Files_Versions\Command\ExpireVersions->expireVersionsForUser() at /var/www/nextcloud/apps/files_versions/lib/Command/ExpireVersions.php:97
 OCA\Files_Versions\Command\ExpireVersions->OCA\Files_Versions\Command\{closure}() at /var/www/nextcloud/lib/private/User/Manager.php:639
 OC\User\Manager->callForSeenUsers() at /var/www/nextcloud/apps/files_versions/lib/Command/ExpireVersions.php:98
 OCA\Files_Versions\Command\ExpireVersions->execute() at /var/www/nextcloud/apps/recognize/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/apps/recognize/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:215
 OC\Console\Application->run() at /var/www/nextcloud/console.php:100
 require_once() at /var/www/nextcloud/occ:11

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions