Repository navigation
OCA\DAV\Connector\Sabre\Exception\FileLocked - DB race condition #8239
Description
Activity
I have the same exact issue. Mine started when I removed a directory while it was still syncing. I had to fix the php file size and now if it put it back it won't sync or if I deleted it I can't delete the empty folder on the server. The data store has a bunch of file parts. But the error in the log is the same as above whenever I try and delete the folder in the UI.
I am on php 7.0 and NC 13.
Just FYI I fixed it by deleting the file from the filecache table and then deleting the folder manually. Hope that helps you. Then ran scan files for the user to be sure everything was well.
Edit: Seems like I can't use the folder name again. If I do the problem comes back and it won't sync and get the same error above again in the logs.
are you using database file locking of nextcloud? Please post the output of
./occ config:list systemSorry for the delay. I haven't seen the error since but in my case it looks like file locking is enabled.
"filelocking.enabled": true,
Me too, waiting for response.
NextCloud v13.0.1
EDIT:
Well, I fix it adding this line to the config file....
sudo nano /var/www/nextcloud/config/config.php 'filelocking.enabled' => false,Reacted by Slavik, TacticalFreak, KORABLEV, ocformula and SGS@nickvergessen I have a number of these errors also.
"OCA\DAV\Connector\Sabre\Exception\FileLocked"
NC 13.0.2
PHP 5.6.35./occ config:list system
"memcache.local": "\\OC\\Memcache\\APCu", "filelocking.enabled": "true", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "timeout": 0 },Same problem with Nextcloud 13.0.4 , php 7.1.18 , redis 4.0.9 with this settings
'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, ),Same problem since I updated to Nextcloud 13.0.4. Was working fine before. Now if I'm doing some stuff like updating/deleting a file that was just created moments ago, I have this error.
Fixed by adding
'filelocking.enabled' => false,... but what does that imply? Is it safe to disable file locking?
Reacted by Laszlo LangSame problem since I updated to Nextcloud 13.0.4. Was working fine before.
Exactly the same problem with my nextcloud instance. It also came with the 13.0,4 update. It seems that the error occurs only if a file is synced, which is locked at my local NTFS file system.
Same here since 13.0.4. Disabling file locking is not a solution for me.
@linucksrox
I can confirm that oc_file_locks table is empty. Only temporary solution which works for me is to:- occ files:cleanup
- occ files:scan -all
- occ maintenance:repair
(currently my repair.sh)
I have tried the solution outlined on the Nextcloud forums (https://help.nextcloud.com/t/file-is-locked-how-to-unlock/1883) but it doesn't help with our issue. We also tried rebooting the client's machine and rebooting the Nextcloud server to no avail.
Another interesting note is that there are 0 records in the oc_file_locks table but the client is still complaining that the files are locked and new entries are still appearing in the server log.In my case, I only had one user complaining about this problem so I did these steps manually:
- paused their desktop client
- moved the folder (and affected files) to another location
- deleted the folder/files from the web interface
- ran occ files:scan --path="username"
- unpaused the client (getting green checkmark at this point)
- moved folder back into place and let it sync
At this point there were some complaints from the client, but after waiting a few minutes they cleared themselves
- went into redis-cli to check which files were locked, as I use redis on a Unix socket, I ran redis-cli -s /var/run/redis/redis.sock --scan
- looked up the file hashes after the fileslocked/ portion of the keys in the oc_filecache table path_hash column (I'm assuming these go together) and confirmed none were present in oc_filecache
- deleted those keys from the redis database one at a time: redis-cli -s /var/run/redis/redis.sock
- DEL "fullkeyvalue"
Maybe none of the redis stuff I did helped anything, but if I run into this issue again I will start by clearing the keys from redis first to see if that makes any difference as it seems to be the only place left that nobody is talking about here.
27 remaining items
Ok, I applied the changes in MemcacheLockingProvider.php yesterday and up to now there are no locking errors. Thanks to everyone!
So what happens next, will it make it to 13.0.5 ?
So what happens next, will it make it to 13.0.5 ?
Yes - it's planned for 13.0.5
Reacted by BurtGummerI see 13.0.5 is out. Did this make it to the release?
Yep, that fix posted above was merged into stable13 on July 10, then 13.0.5 was released on July 23 including the fix. We should probably close this issue.
Still have the issue on 13.0.5
Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO
oc_filecache(mimepart,mimetype,mtime,size,etag,storage_mtime,permissions,parent,checksum,path_hash,path,name,storage) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROMoc_filecacheWHEREstorage= ? ANDpath_hash= ? HAVING COUNT(*) = 0' with params ["1", "2", 1533325280, -1, "5b64afe067e8e", 1533325280, 31, 149894, "", "7fc567a03abec499cb8690b5e6b8f337", "files_versions/tools/firmware", "firmware", 1, 1, "7fc567a03abec499cb8690b5e6b8f337"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-7fc567a03abec499cb8690b5e6b8f337' for key 'fs_storage_path_hash'Seems to be related, having this for 13.0.5
I am having the same issue. Version 13.0.5.
This just happened here today on 13.0.4. I then updated to 13.0.5 and the uploads are working in the app again. Not sure if this is because of the upgrade process or if latest version did fix it. Will post back if comes up again.
I have these errors spamming the logs with a fresh 14 install via docker upon the first single user attempting to sync files. Fixes or recommendations would be appreciated. Reference setup: https://gitlab.com/deepthought/nextcloud-docker
errors:
Fatal | webdav | OCA\DAV\Connector\Sabre\Exception\FileLocked: "..." is lockedresult from
sudo docker exec --user www-data nextcloud-docker_app_1 php occ config:list system:{ "system": { "memcache.local": "\\OC\\Memcache\\APCu", "apps_paths": [ { "path": "\/var\/www\/html\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/www\/html\/custom_apps", "url": "\/custom_apps", "writable": true } ], "filelocking.enabled": true, "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "timeout": 0 }, "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "redacted ip" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "14.0.3.0", "overwrite.cli.url": "http:\/\/localhost", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "instanceid": "***REMOVED SENSITIVE VALUE***" } }Seems related: #6160
Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO
oc_filecache(mimepart,mimetype,mtime,size,etag,storage_mtime,permissions,parent,checksum,path_hash,path,name,storage) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROMoc_filecacheWHEREstorage= ? ANDpath_hash= ? HAVING COUNT(*) = 0' with params ["1", "2", 1533325280, -1, "5b64afe067e8e", 1533325280, 31, 149894, "", "7fc567a03abec499cb8690b5e6b8f337", "files_versions/tools/firmware", "firmware", 1, 1, "7fc567a03abec499cb8690b5e6b8f337"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-7fc567a03abec499cb8690b5e6b8f337' for key 'fs_storage_path_hash'This kind of stuff is fix in a generic way via #12371 and for this specific one additionally in #12413 (which will also be back ported)
Steps to reproduce
Expected behaviour
All files should be deleted
Actual behaviour
All files, except "Nextcloud Manual.pdf" gets deleted
I checked my db for the "locked" table, but all files are set to "0"
Yes, this always happens
Yes, this also happend with other files, as well when I tried to rename files
All tests passed and cron works correct
Server configuration
Operating system: Ubuntu 16.04.3 LTS
Web server: Apache/2.4.29
Database: MySQL 5.7.21
PHP version: 7.2.2
Nextcloud version: 13
Updated from an older Nextcloud/ownCloud or fresh install: clean install
Where did you install Nextcloud from: wget, clean install
Logging