Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"folder is locked" SNAFU #24321

Closed
vasyugan opened this issue Apr 28, 2016 · 13 comments
Closed

"folder is locked" SNAFU #24321

vasyugan opened this issue Apr 28, 2016 · 13 comments

Comments

@vasyugan
Copy link

I accidentally deleted a shared folder. First I restored it locally, but then I found that owncloud wouldn't restore the stares, so I deleted the locally restored file and restored it from owncloud's deleted files to ensure that for the other users, the folder is the same as before.

ownClould restored the folder, but with "(wiederhergestellt)" appended. I wanted to rename it to its original name, but the interface said, that the folder cannot be renamed because the folder is locked, providing no way of unlocking it. So instead I renamed it locally, but the change seemingly wasn't propagated to the server. So now I have an inconsistency between local names and names on the server which apparently cannot be fixed without manipulating the database.

I suppose such SNAFU shouldn't happen. This is what the lockfile says:

Exception: {"Message":"HTTP/1.1 423 "FOLDER (Wiederhergestellt)" is locked","Exception":"OC\Connector\Sabre\Exception\FileLocked","Code":0,"Trace":"#0 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(635): OC\Connector\Sabre\ObjectTree->move('FOLDER (Wiederhe...', 'FOLDER')\n#1 [internal function]: Sabre\DAV\CorePlugin->httpMove(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#2 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#3 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/3rdparty/sabre/dav/lib/DAV/Server.php(469): Sabre\Event\EventEmitter->emit('method:MOVE', Array)\n#4 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/3rdparty/sabre/dav/lib/DAV/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n#5 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/apps/files/appinfo/remote.php(56): Sabre\DAV\Server->exec()\n#6 /var/www/user_userweb/chroot/htdocs/domain.org/www/oc/remote.php(137): require_once('/var/www/user_j...')\n#7 {main}","File":"/var/www/user_userweb/chroot/htdocs/domain.org/www/oc/lib/private/connector/sabre/objecttree.php","Line":239}

@vasyugan
Copy link
Author

I found the oc_file_locks to be completely empty, so I had no way of unlocking, then I accidentally deleted and restored the folder on the server yet again, and this time, it was restored under its original name.

@PVince81
Copy link
Contributor

So instead I renamed it locally

Please never do that, it will mess up badly.

The reason why the folder was locked is probably because people were using it, maybe their sync clients were downloading the contents. You can't rename a folder while people are accessing its contents. Maybe waiting a day or so until activity slows down might give a window of opportunity to rename the folder.

@PVince81
Copy link
Contributor

You might be able to recover stuff by doing a "occ files:scan --all" to resync the file cache with the local changes.

@PVince81
Copy link
Contributor

Not a bug => closing

@vasyugan
Copy link
Author

vasyugan commented Apr 28, 2016

@PVince81 I am aware that I should "never do that". I didn't do the deletion on purpose, it happened by accident. Once the DEL key got pressed by accident, the other time, the cursor was misplaced while clicking. If this ends in a mess, then ownCloud's handling of such situations should be improved. Clearly, a message that "the folder is locked" without any indication to what the reason might be and what the remedy is, is not the best way of handling this. Also, the ownCloud client seems to have been totally confused by it, it gave up with an error. The only remedy I found to avoid data corruption was to delete this ownCloud account on my machine and re-create it and do a clean sync. I fear asking one of my users to do the same might have been asking too much from them already. And the sole cause of this SNAFU was that the DEL key one my keyboard was pressed by accident - which happens. I suppose it happens all the time. So in my view there is a bug here, or a cumulation of bugs.

@PVince81
Copy link
Contributor

Would it help if the message said "Folder is locked because it is being accessed by other users at the moment, please try again later" ?

@PVince81 PVince81 reopened this Apr 28, 2016
@vasyugan
Copy link
Author

I am not sure. I don't think that other users were the cause of the failure to rename the folder. Renaming a folder for yourself doesn't seem to affect other users, they still have the old names. Of course, a clearer warning would be less confusing. The other thing is that I resorted to renaming the folder locally again and this aggravated the mess and made the client simply throw the towel. There is nothing preventing one from a local renaming, but is was not propagated to the server and after I ended and restarted the client, there was no indication of any problem, yet the inconsistency between the local folder name and the one on the server persisted. I have no idea whether this would have eventually been tackled, as there was no information at all

@PVince81
Copy link
Contributor

Renaming a folder for yourself doesn't seem to affect other users

Hmmm you're right. Could also be a bug that locking is too strong here.
Something to investigate.

@icewind1991

@PVince81 PVince81 added this to the 9.1-current milestone Apr 28, 2016
@PVince81
Copy link
Contributor

Could not reproduce this issue on 9.0.2 with a restored then renamed folder

@PVince81 PVince81 modified the milestones: 9.1-current, 9.1.1-next-maintenance Jun 30, 2016
@lowstz
Copy link

lowstz commented Jul 25, 2016

Had the same problem on 9.0.3

@PVince81 PVince81 modified the milestones: 9.1.2, 9.1.1 Sep 21, 2016
@PVince81
Copy link
Contributor

are you guys using ajax cron ? if yes please try switching to system cron, it should make it run more often and also expire stray locks.

@PVince81 PVince81 modified the milestones: 9.1.3, 9.1.2 Oct 20, 2016
@PVince81
Copy link
Contributor

Closing in favor of ajax cron ticket #20380

@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants