Server: Permanently deleting multiple files from trash does not work and results in OCP\Lock\LockedException

Created on 21 Jul 2019  ·  43Comments  ·  Source: nextcloud/server

Steps to reproduce

  1. Delete multiple files; make sure mp3, pdf, and jpegs are deleted
  2. Go to trash on the web frontend
  3. Select all files and select delete permanently

Expected behaviour

All files are removed without errors.

Actual behaviour

I see the error "Fehler beim Entfernen von Dateien aus dem Papierkorb".

Sometimes a few files are removed (from the disk and from the list). On all still visible files there are spinners visible.

I had similar problems with ownCloud before, however, there such errors were fixed.

Server configuration

Operating system: Debian 9.8

Web server: Apache 2.4

Database: MariaDB 10.1.38

PHP version: 7.3.7

Nextcloud version: 16.0.3.0 (was also in 16.0.1.1)

Updated from an older Nextcloud/ownCloud or fresh install: Upgraded from ownCloud 10.0.1 to NC12,13,14,15,16

Where did you install Nextcloud from: https://nextcloud.com/install/#instructions-server, tar.bz2

Signing status:


Signing status

No errors have been found.

List of activated apps:


App list

Enabled:
  - accessibility: 1.2.0
  - activity: 2.9.1
  - announcementcenter: 3.5.1
  - cloud_federation_api: 0.2.0
  - comments: 1.6.0
  - dav: 1.9.2
  - federatedfilesharing: 1.6.0
  - federation: 1.6.0
  - files: 1.11.0
  - files_external: 1.7.0
  - files_pdfviewer: 1.5.0
  - files_rightclick: 0.13.0
  - files_sharing: 1.8.0
  - files_texteditor: 2.8.0
  - files_trashbin: 1.6.0
  - files_versions: 1.9.0
  - files_videoplayer: 1.5.0
  - firstrunwizard: 2.5.0
  - gallery: 18.3.0
  - logreader: 2.1.0
  - lookup_server_connector: 1.4.0
  - nextcloud_announcements: 1.5.0
  - notifications: 2.4.1
  - oauth2: 1.4.2
  - provisioning_api: 1.6.0
  - serverinfo: 1.6.0
  - sharebymail: 1.6.0
  - systemtags: 1.6.0
  - text: 1.0.1
  - theming: 1.7.0
  - twofactor_backupcodes: 1.5.0
  - updatenotification: 1.6.0
  - viewer: 1.0.0
  - workflowengine: 1.6.0
Disabled:
  - admin_audit
  - encryption
  - password_policy
  - privacy
  - recommendations
  - support
  - survey_client
  - user_ldap

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "16.0.3.0",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "forcessl": true,
        "loglevel": 2,
        "integrity.check.disabled": false,
        "apps_paths": [
            {
                "path": "\/var\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            }
        ],
        "maintenance": false,
        "theme": "",
        "overwrite.cli.url": "https:\/\/MYSERVER",
        "overwriteprotocol": "https",
        "activity_expire_days": 31,
        "trusted_domains": [
            "MYSERVER"
        ],
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto",
        "htaccess.RewriteBase": "\/",
        "mail_smtpmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "appstore.experimental.enabled": false,
        "singleuser": false,
        "log_rotate_size": 104857600,
        "logtimezone": "Europe\/Berlin",
        "mail_sendmailmode": "smtp",
        "app_install_overwrite": [
            "admin_notifications"
        ],
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "dbindex": 1,
            "timeout": 0
        },
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Mozilla Firefox 68.0.1 (but also experienced with older Firefox)

Operating system: Win 7 x64

Logs

Web server error log


Web server error log

XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/1.mp3.d1563726267 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/2.mp3.d1563726292 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/3.mp3.d1563726267 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/4.mp3.d1563726267 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/5.mp3.d1563726269 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/6.mp3.d1563726274 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/7.mp3.d1563456500 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/8.mp3.d1563726273 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/9.mp3.d1563533419 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/10.mdzip.bak.d1563193662 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/11.zip.gpg.d1563624216 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/12.mp3.d1563456509 HTTP/2.0" 500 238 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:40 +0200] "DELETE /remote.php/dav/trashbin/USER/trash/13.mp3.d1563726266 HTTP/2.0" 204 0 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:25:46 +0200] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 200 81 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
XXXX - - [21/Jul/2019:18:26:16 +0200] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 200 81 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"

Nextcloud log (data/nextcloud.log)


Nextcloud log

{"reqId":"fNBablojNgbdf3aUisgu","level":4,"time":"2019-07-21T18:25:41+02:00","remoteAddr":"XXXX","user":"USER","app":"webdav","method":"DELETE","url":"\/remote.php\/dav\/trashbin\/USER\/trash\/1.mp3.d1563726267","message":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files\/763a2e578bf5646da6c362952851c861\" is locked","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Common.php","line":715,"function":"acquireLock","class":"OC\\Lock\\DBLockingProvider","type":"->","args":["files\/763a2e578bf5646da6c362952851c861",2]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Common","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Scanner.php","line":331,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":868,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->","args":["files_trashbin\/versions"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":614,"function":"getVersionsFromTrash","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/1.mp3",1563726267,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":579,"function":"deleteVersions","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":[{"__class__":"OC\\Files\\View"},"\/1.mp3.d1563726267","\/1.mp3",1563726267,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":90,"function":"delete","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/1.mp3","USER",1563726267]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashManager.php","line":69,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","line":83,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Tree.php","line":179,"function":"delete","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":287,"function":"delete","class":"Sabre\\DAV\\Tree","type":"->","args":["trashbin\/USER\/trash\/1.mp3.d1563726267"]},{"function":"httpDelete","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/1.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpDelete"],[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/1.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:DELETE",[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/1.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/1.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php","line":316,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloud\/lib\/private\/Lock\/DBLockingProvider.php","Line":209,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}
{"reqId":"z7ZbeNutfgwizofAkv8h","level":4,"time":"2019-07-21T18:25:41+02:00","remoteAddr":"XXXX","user":"USER","app":"webdav","method":"DELETE","url":"\/remote.php\/dav\/trashbin\/USER\/trash\/3.mp3.d1563726267","message":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files\/763a2e578bf5646da6c362952851c861\" is locked","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Common.php","line":715,"function":"acquireLock","class":"OC\\Lock\\DBLockingProvider","type":"->","args":["files\/763a2e578bf5646da6c362952851c861",2]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Common","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Scanner.php","line":331,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":868,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->","args":["files_trashbin\/versions"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":614,"function":"getVersionsFromTrash","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/3.mp3",1563726267,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":579,"function":"deleteVersions","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":[{"__class__":"OC\\Files\\View"},"\/3.mp3.d1563726267","\/3.mp3",1563726267,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":90,"function":"delete","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/3.mp3","USER",1563726267]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashManager.php","line":69,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","line":83,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Tree.php","line":179,"function":"delete","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":287,"function":"delete","class":"Sabre\\DAV\\Tree","type":"->","args":["trashbin\/USER\/trash\/3.mp3.d1563726267"]},{"function":"httpDelete","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/3.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpDelete"],[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/3.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:DELETE",[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/3.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/3.mp3.d1563726267","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php","line":316,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloud\/lib\/private\/Lock\/DBLockingProvider.php","Line":209,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}
{"reqId":"LK5a5bBx8JX9ma95iDvm","level":4,"time":"2019-07-21T18:25:41+02:00","remoteAddr":"XXXX","user":"USER","app":"webdav","method":"DELETE","url":"\/remote.php\/dav\/trashbin\/USER\/trash\/2.mp3.d1563726292","message":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files\/763a2e578bf5646da6c362952851c861\" is locked","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Common.php","line":715,"function":"acquireLock","class":"OC\\Lock\\DBLockingProvider","type":"->","args":["files\/763a2e578bf5646da6c362952851c861",2]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Common","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":593,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/lib\/private\/Files\/Cache\/Scanner.php","line":331,"function":"acquireLock","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["scanner::files_trashbin\/versions",2,{"__class__":"OC\\Lock\\DBLockingProvider"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":868,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->","args":["files_trashbin\/versions"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":614,"function":"getVersionsFromTrash","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/2.mp3",1563726292,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trashbin.php","line":579,"function":"deleteVersions","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":[{"__class__":"OC\\Files\\View"},"\/2.mp3.d1563726292","\/2.mp3",1563726292,"USER"]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/LegacyTrashBackend.php","line":90,"function":"delete","class":"OCA\\Files_Trashbin\\Trashbin","type":"::","args":["\/2.mp3","USER",1563726292]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Trash\/TrashManager.php","line":69,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\LegacyTrashBackend","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","line":83,"function":"removeItem","class":"OCA\\Files_Trashbin\\Trash\\TrashManager","type":"->","args":[{"__class__":"OCA\\Files_Trashbin\\Trash\\TrashItem"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Tree.php","line":179,"function":"delete","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":287,"function":"delete","class":"Sabre\\DAV\\Tree","type":"->","args":["trashbin\/USER\/trash\/2.mp3.d1563726292"]},{"function":"httpDelete","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/2.mp3.d1563726292","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpDelete"],[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/2.mp3.d1563726292","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:DELETE",[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/2.mp3.d1563726292","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/MYSRV\/remote.php\/dav\/trashbin\/USER\/trash\/2.mp3.d1563726292","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php","line":316,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloud\/lib\/private\/Lock\/DBLockingProvider.php","Line":209,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; Win64; x64; rv:68.0) Gecko\/20100101 Firefox\/68.0","version":"16.0.3.0"}

Browser log


Browser log

No errors in the javaScript console.
Some 500er errors for the selected files with `DELETE` requests, one `DELETE` request finished with a 204.

1. to develop bug

Most helpful comment

I have this problem as long as I can remember. I once figured out that disabling file locking does solve this. So I usually disable it, delete the files in trash and enable it again.

Simply set 'filelocking.enabled' => false, in nextcloud/config/config.php and try to delete the files.

As this is obviously not a real solution to the problem I am also interested in other ideas.

All 43 comments

Looks like you have configured Redis but gave it no job.
Please see https://docs.nextcloud.com/server/16/admin_manual/configuration_files/files_locking_transactional.html for how to configure Redis for transactional file locking.
That should fix your problem.

On the page you linked, there is nothing written about a job.

I have this problem as long as I can remember. I once figured out that disabling file locking does solve this. So I usually disable it, delete the files in trash and enable it again.

Simply set 'filelocking.enabled' => false, in nextcloud/config/config.php and try to delete the files.

As this is obviously not a real solution to the problem I am also interested in other ideas.

On the page you linked, there is nothing written about a job.

Sure it is, it shows how to configure Redis as backend for transactional file locking.

@wiswedel I see, youn mean 'memcache.local' => '\\OC\\Memcache\\Redis', and 'memcache.locking' => '\\OC\\Memcache\\Redis', are missing. That was a mistake in the original report, I removed those two lines because I hoped disabling this would sovle the issue. - It does not.

Even if Redis is not correctly set up, then this issue seems to be independent of Redis.

I'd like to confirm I have the same issue with the trashbin, and I don't believe it's Redis since I don't have that setup. I use APCu for memcaching and have no memcache lock setup in my config.

By adding 'filelocking.enabled' => false, the trashbin deleted more than one file at a time again.

Possibly related: https://github.com/nextcloud/server/issues/12281

gixxxerg wrote https://github.com/nextcloud/server/issues/12281#issuecomment-448240687

in the web interface it is a bug
when selecting the file on the left side and then selecting delete from the menu does not delete the file
see image:
nodeletion

when deleting the file one at a time on the right side however, the files does get deleted
see image:
deletion

I am coming here from issue https://github.com/nextcloud/server/issues/16665

When I decide to delete multiple files from the trash they aren't removed. The turning icon keeps looping infinitely; I do not get an error message. Refreshing the page and then deleting files by single works.

I use Raspian/Debian 10, PHP 7.3, 10.3.15-MariaDB, Apache 2.4 and Nextcloud 16.0.3 without having upgraded from a previous version.

Yeah, that was the exact same issue I was having. I don't know exactly what the issue is but the workaround I used that was listed above was to add 'filelocking.enabled' => false, into the nextcloud config file. That seems to fix it for now.

I just tested to delete files one by one. Then it seems to work fine. Just when I select multiple files (two is already enough) I get this error.

There seem to risks associated with disabling file locking. I am now also receiving a "423 Locked" error from a GET request in the Windows desktop app as indicated there:
https://help.nextcloud.com/t/file-is-locked-how-to-unlock/1883

I have also been trying to rsync my data, however the rsync process gets stuck. Perhaps this is because some files are blocked or currupted.

Same problem in 16.0.4

Having the similar problem when recovers the file, click on the button one by one gives no problem but once in batch, the error occurs.
However, this seems does not occur on try.nextcloud.com with SQLite as backend. @wiswedel

Looks like you have configured Redis but gave it no job.
Please see https://docs.nextcloud.com/server/16/admin_manual/configuration_files/files_locking_transactional.html for how to configure Redis for transactional file locking.
That should fix your problem.

I setted up Redis, but it is not resolved the issue. Could you please check it?

@skjnldsv Could you maybe take a look?

@wiswedel I'm really not the locking expert ;)
cc @rullzer @icewind1991

I'm really not the locking expert ;)

@skjnldsv But the triaging expert 🦸‍♂️

Still an issue with Nextcloud 16.0.6.

The only 'fix' I found is temporarily disable locking on the config.php
'filelocking.enabled' => false,

Still an issue with 17.0.1

@csware if this ticket is still set to 1. to develop and is not closed, it's indeed still not fixed :)

I can still confirm this behavior with 17.0.2

The only 'fix' I found is temporarily disable locking on the config.php
'filelocking.enabled' => false,

Yes, same here when using Object Storage (S3 compatible) as primary storage at least. otherwise, a lot of LockedException occurs, not only deleting but also when writing thousands of files.

It's still an issue on Nextcloud 18.0.0.

Have the same issue for only one user, if he selects multiple files in the trashbin for permanent deletion, only one file is deleted, other files are not deleted with error message:
Error in Log: OCP\LockLockedException: "files/d881fa9b9ee48752a867c90e7a242a99" is locked, existing lock on file: exclusive

NC is accessed from MacOS.

Setup: NC 18.0.1, PHP 7.3.15, MySQL 5.7.29

disabling filelocking doesn't help.. (true -> false)

'memcache.local' => '\OC\Memcache\Redis', (-> enough RAM, so we don't use APCu)
'filelocking.enabled' => 'true',
'filelocking.ttl' => 60*60,
'memcache.locking' => '\OC\Memcache\Redis',
'redis' =>
array (
'dbindex' => '0',
'host' => 'localhost',
'port' => '6379',
'timeout' => '1.5',
),

occ files:scan --all -> didn't help aswell.

occ files:cleanup -> didn't try yet, because the consequences are not exactly clear to me.

Anyone else still have this issue?

'filelocking.enabled' => 'true',

If you replace 'true' with 'false' the locking is still enabled. 'false' is a string and will evaluate to true if used in a boolean comparison. Use false without quotes and the locking will be disabled.

Please also check this https://github.com/nextcloud/server/issues/19163, the 'side issue'.

my fault, should have read more carefully the other posts. But this is probably still just a workaround. thnx for your help

I'm still seeing this problem with NC 8.0.3. Relevant config settings on my install are:
'filelocking.enabled' => true, 'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => '/var/run/redis/redis.sock', 'port' => 0, ),
Users are complaining about how hard this makes it to delete files, though of course we can disable file locking. But does seem like a poor solution. One client of ours is even hinting that they want us to refund them some of the money they paid for the disk space they occupied while they weren't able to easily permanently delete files. :(

I noticed that I didn't have a filelocking.ttl set in any of our NC config files. I have just set the TTL to one hour, and that _may_ have solved some of the deletion problems that I was seeing. I'm not sure what the default TTL is if none is set in the config. I would guess that the TTL needs to be set, and NC's cron job has to be running correctly, to not have the problems when permanently deleting multiple files. I will monitor to see if the problem still occurs.

I just tried to follow your suggestion. Default according config.sample.conf is:

'filelocking.ttl' => 60*60,
Set the lock's time-to-live in seconds.
Any lock older than this will be automatically cleaned up.
Defaults to ``60*60`` seconds (1 hour) or the php
max_execution_time, whichever is higher.

I tested various different settings for both values and am not able to fix the behaviour. As I don't really understand the full details about this settings I would love to see others also have a look at this.

But I agree, this is really a big pain regarding any customers and the manual effort to delete any files. I would love to see this at a little higher priority if possible..

Bug is still present on NC 17.0.6.2 (PHP 7.3.14, MariaDB 10.3.22). Likely the same underlying problem as in #20362 .

Same issue here with 17.0.0 from stable/nextcloud helm chart with redis.

I had hoped that removing 'memcache.locking' => '\\OC\\Memcache\\Redis', from my config file, and thus falling back to MariaDB for locking instead of Redis, would fix this problem. However, I have deactivated the Redis lock caching, and can see that NC is now using the MariaDB database for locking at this point, but the problem persists. Only one trash bin item is deleted at a time.

The only fix I know is to disable file locking completely for the instance, which comes with risks of file corruption. Has anyone else manage to track down the origin of this problem, or have any other fixes that worked?

Same problem here; it has been present for a while (1+ year, I'd say), recently it was solved but now (since NC 18, maybe?) it's back again.
Clicking the delete button again removes the first of the selected files, but throws other errors on the remaining files.

Nextcloud 18.0.4, nginx 1.17.10, PHP 7.4.6, Redis 6.0.1, MariaDB 10.4.12

I have the same problem
Nextcloud 19.0.0
Docker image: nextcloud: fpm

Hi guys,
I've tried everything also disabling the locking nothing I cannot delete files form the trash.
Is there an hard way to do it maybe on the DB ?

You can disable the lock in config.php the line "file.locking"
Or you can manually delete the file in the trash folder placed under the user name in the system

Sincerely
XINGZ


From: babaz8 notifications@github.com
Sent: Wednesday, July 15, 2020 5:34:09 PM
To: nextcloud/server server@noreply.github.com
Cc: ZHAO, Xing xingz@link.cuhk.edu.hk; Comment comment@noreply.github.com
Subject: Re: [nextcloud/server] Permanently deleting multiple files from trash does not work and results in OCP\LockLockedException (#16491)

Hi guys,
I've tried everything also disabling the locking nothing I cannot delete files form the trash.
Is there an hard way to do it maybe on the DB ?


You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/nextcloud/server/issues/16491#issuecomment-658660526, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACETSDCUTQOBHIEPA456HSTR3VZZDANCNFSM4IFS4OFA.

@jvsalo may I ask if https://github.com/nextcloud/server/pull/21710 can help in this specific case ❓

I am have the same issue only on S3 storage used as external storage:

Nextcloud Version : 19.0.1.1
Server version: Apache/2.4.41 (Ubuntu)
PHP 7.4.3
mysql  Ver 15.1 Distrib 10.3.22-MariaDB

I tried with aws S3 and Backblaze B3 (as s3). When I select multiple files and delete, only one file gets deleted and gives error for the rest.

I am having the same issue. I have not modified anything from the snap, it is all vanilla.
I use the Nextcloud Snap on Ubuntu v20.04.
Current version for Snap is:
Nextcloud 19.0.3
Apache 2.4
PHP 7.3
MySQL 5.7
Redis 5.0
mDNS for network discovery

Just updated to nextcloud 20.0.0 and still have this problem.

PHP Version: 7.4.3
mysql Version: 8.0.21
Redis server v=5.0.7

The log contains a lot of lines like:
Fatal | webdav | OCP\Lock\LockedException: "files/5813b2c0704a60385854d1df7fcbac1c"("home::username::scanner::files_trashbin/versions") is locked, existing lock on file: exclusive

Was this page helpful?
0 / 5 - 0 ratings