File is locked - how to unlock

This advice is very outdated and should probably just be deleted. I cause this issue by ^C exiting a file scan, and was then able to fix it quite simply by running occ maintenance:repair.

A post was split to a new topic: File is locked error in hosted environments

I have had this file Lock issue over some 6 years now very internmitanty, I have been just logging in as root and remove the folder or file from the nextcloud data then it disappears from the web interface/database. Not sure if it does harm to the database?

I started out testing using nextcloud with Lamp stack in 2017 Version 11 or 12 ?

It happens a lot less now but it did on the older hardware like I was using.

Nextcloud 12
Pentium 4 2.80 GHz, released from 2002
512 MB ram
160 GB IDE, my friend still has the HDD as backup now because I did a rescue and upgrade to NC 24 after the power supply stopped last year.

Pentium 4 3.0 GHz, released from 2003
1024 MB ram

Raspberry Pi 3B
Running on 2 x 4 TB SATA with external USB to SATA 2 powered dock. I tested cron backups every day by just with a copy of the data folder to another drive.

Currently using a few i5-4670 CPU @ 3.40GHz, released in 2013
I recycle old computers and the rubbish tip has good lately.

The problem of the locked files do have several issues (both, open ones and also closed by inactivity) and should definitely be fixed soon. It occurs on my Nextcloud version 24.0.9 especially on image files (.jpg) but only on about 10 files out of 50k. I got them unlocked again now and I keep an eye on it if on the next sync of a bigger amount of files.
It may be related to following issue, if uploads do take longer than an hour (3600 seconds) OCA\DAV\Connector\Sabre\Exception\FileLocked - Redis race condition Β· Issue #9001 Β· nextcloud/server Β· GitHub

1 Like

Thought it would be easier to use the docke compose script on the nextcloud docker hub page.
(Using Base version - apache)
However that end up right into this pitfall.

Put in 12000 files about 22GB, now lots of files got 423 locked, the windows client has retried sync loop for two days without a result.

Now it seems I would have to go into the docker image, edit config files, edit the database etc etc. Which is rather a complicated case for a new start.

If this error is very likely to happen, maybe the docker hub page should mention this, for example, if you are going to sync a large number of files, consider using a memcahce/redis for Transactional file locking. Or maybe the base docker image should provide either memcache or redis either within the nextcloud docker image itself as an option for the user, or within the compose script as a seperate docker image.