Stray locks not being cleaned: server replied: Locked (ajax cron)
Hi there,
I have problems uploading some files via windows 7 client (Version 2.0.2, build 5569) connected with an owncloud 8.2 stable-Server.
The files exist on the client, not on the server. The log file on the client says:
06.11.2015 23:07:35 folder1/xxx.MDB F:\Cloud1 Error downloading http://xxx/owncloud/remote.php/webdav/folder1/xxx.MDB - server replied: Locked ("folder1/xxx.MDB" is locked)4,3 MB
I wonder why the client has problems to download - it should try to upload.
At first I thougt that the file on the client could be in use by another program. But the server says, that the file ist locked, not the client.
Can anyone help me please?
Regards, klausguenter
cc @icewind1991 for the locking topic
I believe the error message in the client says "download" even when uploading, it's another issue.
The question here is why the file is locked in the first place. Are there other users accessing that folder ?
I suspect a stray lock.
It's possible that the files to upload were in use by another program when the sync-client tried to upload them for the first time. When the problem occured I did a restart of the client pc to make sure that these files are not in use by another program any more. But the files kept being not uploadable.
I have exact the same problem. It suddenly occured for one file and for the first time. I'm the only one who is syncing to this directory (3 PCs, 2 mobile devices). I can not overwrite or delete it. Came here from https://forum.owncloud.org/viewtopic.php?t=31270&p=100790 and tried this procedure:
- deleting via client
- deleting via webpage
- deleting physical files from data folder and corresponding encryption keys
- running occ files:scan and occ files:cleanup
- truncated table oc_filecache
Server configuration
Operating system: Raspbian 8 Web server: Nginx Database: Mysql PHP version: 5.6.14 ownCloud version: (see ownCloud admin page) 8.2.0.12 List of activated apps:
- activity: 2.1.3
- files: 1.2.0
- files_pdfviewer: 0.7
- files_sharing: 0.7.0
- files_texteditor: 2.0
- files_trashbin: 0.7.0
- files_versions: 1.1.0
- gallery: 14.2.0
The content of config/config.php:
"system": {
"instanceid": "oc788abd2781",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"datadirectory": "\/var\/ocdata",
"dbtype": "mysql",
"version": "8.2.0.12",
"installed": true,
"config_is_read_only": false,
"forcessl": true,
"loglevel": 2,
"theme": "",
"maintenance": false,
"trashbin_retention_obligation": "30, auto",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
],
"mail_smtpmode": "php",
"dbname": "owncloud",
"dbhost": "localhost",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"forceSSLforSubdomains": true,
"memcache.local": "\\OC\\Memcache\\APCu"
}
Error message from logfile:
{"reqId":"5h4sJPhlw0mjlWNp5wdl","remoteAddr":"94.87.129.34","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"safe.kdbx\\\" is locked\",\"Exception\":\"OC\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Tree.php(179): OC\\\\Connector\\\\Sabre\\\\File->delete()\\n#1 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(287): Sabre\\\\DAV\\\\Tree->delete('safe.kdbx')\\n#2 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpDelete(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#4 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(469): Sabre\\\\Event\\\\EventEmitter->emit('method:DELETE', Array)\\n#5 \\\/var\\\/www\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/files\\\/appinfo\\\/remote.php(55): Sabre\\\\DAV\\\\Server->exec()\\n#7 \\\/var\\\/www\\\/owncloud\\\/remote.php(137): require_once('\\\/var\\\/www\\\/ownclo...')\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/connector\\\/sabre\\\/file.php\",\"Line\":300}","level":4,"time":"2015-11-09T22:34:35+00:00","method":"DELETE","url":"\/remote.php\/webdav\/safe.kdbx"}
Server configuration
Operating system: Debian 7 stable Web server: Apache 2.2.22 Database: Mysql 5.5.46 PHP version: 5.4.45 ownCloud version: 8.2.0.12 (stable) List of activated apps:
activity: 2.1.3
deleted files: 0.7.0
first run wizard 1.1
Gallery 14.2.0
Mail Template Editor 0.1
Notifications 0.1.0
Provisioning API 0.3.0
Share Files 0.7.0
Text Editor 2.0
Updater 0.6
Versions 1.1.0
Video Viewer 0.1.3
The content of config/config.php:
$CONFIG = array ( 'instanceid' => '_', 'passwordsalt' => '', 'secret' => '**', 'trusted_domains' => array ( 0 => '_', 1 => '', ), 'datadirectory' => '**', 'overwrite.cli.url' => '', 'dbtype' => 'mysql', 'version' => '8.2.0.12', 'dbname' => 'owncloud1', 'dbhost' => 'localhost', 'dbtableprefix' => 'oc', 'dbuser' => '_', 'dbpassword' => '***', 'logtimezone' => 'UTC', 'installed' => true, 'filelocking.enabled' => 'true', 'memcache.locking' => '\OC\Memcache\Redis', 'memcache.local' => '\OC\Memcache\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, 'timeout' => 0, ), );
Do you also get files locked errors when trying to upload trough the web interface?
Yes
i had the same problem. My workaround : Enable maintaince mode Deleted every entry in table "oc_file_locks" in database Disable Maintaince mode
Dirty but solved the problem ... for now
I've found some additional files which can not be deleted because they are locked. If you need additional debug data let me know....
Are there any errors in the logs before the locking error shows up?
I see no other errors before the locking error. It occures just in the moment I want to modify or delete a file. All this "problem" files were present before the update to Owncloud 8.2. Maybe the error came with this version.
Here is my owncloud.log https://gist.github.com/unclejamal3000/2aba05cd32cc53771256
I do have the same problem with a fresh installation of 8.2 I did not have this problem on older version on the same server.
This is happening to me (on both 8.2 and 8.2.1, with MySQL), particularly (I think) since I added Dropbox external storage to one of my users (another user already had Dropbox set up previously with no problems).
Possibly of note: I just tried cleaning things up, by turning on maintenance mode, deleting everything from oc_file_locks, then running occ files:scan --all. After doing the latter, and with maintenance mode still turned on, there are now 10002 rows in oc_file_locks. Is that expected? I assumed there would only be locks if something was still using the files (which no clients would be, since it's in maintenance mode, and since the files:scan process finished, it wouldn't still be holding onto locks, would it?).
After doing the latter, and with maintenance mode still turned on, there are now 10002 rows in oc_file_locks. Is that expected?
For performance reasons (since 8.2.1) rows are not cleaned up directly but re-used in further requests
Fair enough, so that's probably not related to the issue, then. For what it's worth, I've removed the Dropbox external storage from this particular user, and haven't had any file locking problems so far since then. That may be coincidence, of course, or just that the particular files being synched with the Dropbox folder were the ones likely to cause the locking issue.
All of our s3 files are locked. We cannot delete or rename any files that were there previous to 8.2 update. UGGG is this fixable? we have thousands of files on s3.
Same on OC v8.2.1 with TFL and Memcaching via Redis as recommended. Anyway, there are a few entries in oc_file_locks (although through using Redis there shouldn´t be any locks?). No idea how to fix this. Only one specific file affected, making me and the never-ending, logfile-filling desktop clients going crazy.
Thankful for every tip or workaround! No idea how to "unlock" the file...
@icewind1991 are you able to reproduce this issue ?
For DB-based locking it might be possible to remove the locks by cleaning the "oc_file_locks" table.
If you're using redis exclusively for ownCloud, you might be able to clear it using the command flushall using redis-cli.
Are you guys using php-fpm ? I suspect that if the PHP process gets killed due to timeouts, the locks might not get cleared properly. However I thought that locks now have a TTL, @icewind1991 ?
Yes, php-fpm is in the game too. @PVince81 perfect! That was what I was looking for (at http://redis.io/commands). For the moment syncing works fine again.
Do you know the cli for listing all keys/locked files on redis-cli too?
And I still don´t get why oc_file_locks has entries although using redis...