Can not delete multiple files from trash bin permantly

Can not delete multiple files from trash bin permantly

Nextcloud version (eg, 18.0.2): 17.0.2
Operating system and version (eg, Ubuntu 20.04): Debian 9.12
Apache or nginx version (eg, Apache 2.4.25): 2.4.25
PHP version (eg, 7.1): 7.3.15

The issue you are facing: I cannot remove more than one file permantly.

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

Steps to replicate it:

  1. Select more than one file
  2. Try to remove them.
  3. An error occurs.

If I try to remove the same items permantly one by one, it works.

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: OCP\Lock\LockedException: "files/faae9471604ff8d90257371d461f6c6f" is locked at <<closure>>

 0. /var/www/nextcloud/lib/private/Files/Storage/Common.php line 743
    OC\Lock\DBLockingProvider->acquireLock("files/faae9471604ff8d90257371d461f6c6f", 2)
 1. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 593
    OC\Files\Storage\Common->acquireLock("scanner::files_trashbin/versions", 2, OC\Lock\DBLockingProvider {})
 2. /var/www/nextcloud/lib/private/Files/Cache/Scanner.php line 331
    OC\Files\Storage\Wrapper\Wrapper->acquireLock("scanner::files_trashbin/versions", 2, OC\Lock\DBLockingProvider {})
 3. /var/www/nextcloud/apps/files_trashbin/lib/Trashbin.php line 873
    OC\Files\Cache\Scanner->scan("files_trashbin/versions")
 4. /var/www/nextcloud/apps/files_trashbin/lib/Trashbin.php line 619
    OCA\Files_Trashbin\Trashbin::getVersionsFromTrash("/AutoBackup_201 ... s", 1577987802, "bbruecker")
 5. /var/www/nextcloud/apps/files_trashbin/lib/Trashbin.php line 584
    OCA\Files_Trashbin\Trashbin::deleteVersions(OC\Files\View {}, "/AutoBackup_201 ... 2", "/AutoBackup_201 ... s", 1577987802, "bbruecker")
 6. /var/www/nextcloud/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php line 90
    OCA\Files_Trashbin\Trashbin::delete("/AutoBackup_201 ... s", "bbruecker", 1577987802)
 7. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 69
    OCA\Files_Trashbin\Trash\LegacyTrashBackend->removeItem(OCA\Files_Trashbin\Trash\TrashItem {})
 8. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php line 83
    OCA\Files_Trashbin\Trash\TrashManager->removeItem(OCA\Files_Trashbin\Trash\TrashItem {})
 9. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\AbstractTrash->delete()
10. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 287
    Sabre\DAV\Tree->delete("trashbin/bbruec ... 2")
11. <<closure>>
    Sabre\DAV\CorePlugin->httpDelete(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
12. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    undefinedundefinedcall_user_func_array([Sabre\DAV\CorePlugin {},"httpDelete"], [Sabre\HTTP\Requ ... }])
13. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    Sabre\Event\EventEmitter->emit("method:DELETE", [Sabre\HTTP\Requ ... }])
14. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
15. /var/www/nextcloud/apps/dav/lib/Server.php line 317
    Sabre\DAV\Server->exec()
16. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
17. /var/www/nextcloud/remote.php line 163
    undefinedundefinedrequire_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/bbruecker/trash/AutoBackup_20190705_172033_Motorola_XT1635-02.mhs.d1577987802
from 88.66.223.140 by bbruecker at 2020-04-22T20:38:16+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => '***',
  ),
  'datadirectory' => '/var/oc-data',
  'dbtype' => 'mysql',
  'version' => '17.0.2.1',
  'overwrite.cli.url' => '***',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_from_address' => 'bb',
  'mail_domain' => '***',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '***t',
  'mail_smtpname' => '***',
  'mail_smtppassword' => '***',
  'mail_smtpsecure' => 'tls',
  'mail_smtpport' => '25',
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'beta',
  'updater.secret' => '***',
);

The output of your Apache/nginx/system log in /var/log/____:

To much, what can be relevant? No errors.

It’s better for performance to use redis for file-locking (the normal database can have trouble to catch up with all the activities). Not sure if the file is still locked and can’t be moved to the trashbin for that reason.

Can you delete single files? Is it always if you select several that you get this error?

Also keep in mind: 17.0.2 is not the latest release, there have been a few fixes on this branch already: https://nextcloud.com/changelog/#latest17

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

PS: The solution for me was to execute the command:

sudo -u www-data php occ trashbin: cleanup myusername

wheremyusernameis my account name

Then the basket was completely empty
In the future, the problem is not observed.

PPS: The problem still remains
If you select all the files in the recycle bin, they are deleted
If you select multiple files, an error occurs and only the first of the selected files is deleted

‘filelocking.enabled’ => false,

in ./config/config.php solves the problem, but this is a bad solution, since the lock is disabled completely

You could try to check what process enabled the locking and doesn’t release the locking. Unfortunately, I can’t give you a guide and I don’t know if it is easy…