This is an aftereffect of Bug #72157: Problem: When a document is opened via WebDAV and saved (not closed), then LibreOffice releases mistakenly the LOCK. This must only happen, when the document is closed and not just saved. Steps to reproduce: 1. Open a document via WebDAV (GET + LOCK is send to the webserver) 2. Save the document on WebDAV (UNLOCK + PUT is send to the webserver) 3. Close the document (nothing is send to the webserver) Affected versions: - 4.2.6.2 (release) - 4.3.0.4 (release) Additional comments: In Bug #72157 comment 28 and later some other people already confirmed this problem. Samuel Mehrbrodt told to create a new bug report about this issue.
This problem still exists in 4.4.1.2.
I did a little digging into this bug, and it seems the problem is caused by the destructor of Content (webdavcontent.cxx) assuming it is OK to unlock the document. When saving (but not closing), the Content object is destroyed and recreated, thereby unlocking the document on the server. Of course, in this instance the unlock never should have been sent. I found the original(?) bug from Open Office which discusses the problem a little more: https://bz.apache.org/ooo/show_bug.cgi?id=29152. It seems the original developers who considered this issue recommended an explicit lock/unlock strategy: https://bz.apache.org/ooo/show_bug.cgi?id=29152#c113. Quoting: "The OOo document load/save framework is the right place to decide whether a lock is needed for the document resource. All needed context is available there." Currently we're using an implicit approach, where the Content object in the UCB decides when to lock/unlock based on when it is created and destroyed. I'm no LO expert, but the UCB seems too low of a level in the framework to make the right decision. I see that the webdavcontent.cxx::Content class supports the "lock" and "unlock" command through Content::execute(). Maybe we could execute("lock") on document open from the load/save framework, and similarly execute("unlock") on document close. Is this a reasonable approach? If so, my next task is to find the correct place to implement these calls. FWIW, I looked at how the OneDrive/SharePoint checkin and checkout works (since the concepts are similar to lock/unlock). Unfortunately it wasn't much help, since in those cases the user manually checks documents in and out, whereas here we want it to happen automatically.
I recently added the WebDAV lock/unlock mechanism in AOO. https://bz.apache.org/ooo/show_bug.cgi?id=126305 it's scheduled to be included in 4.1.2. In AOO the lower WebDAV layer is managed by serf, not by neon, the work there was a little different, but I implemented the framework strategy for lock/unlock. If I'm assigned this bug, I'll do the rewriting for LibO for the framework part.
> If I'm assigned this bug, I'll do the rewriting for LibO for the framework part. Your work would be very welcome - please go ahead :)
(In reply to Samuel Mehrbrodt from comment #4) Ok, work in progress.
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=26e6d4b05ab444e6a7529ffcac7fbe592fc94833 tdf#82744: fix WebDAV lock/unlock behaviour - part 1 It will be available in 5.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=bc9a8ddbb7081f79e915c841e56fd1c40f0df6f9 tdf#82744: fix WebDAV lock/unlock behaviour - part 2 It will be available in 5.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
For the sake of clarity, the two commits above are not the only needed. There is one that has not been pushed yet. I'll post a note as soon as all the patches implementing the issue fix are pushed to master.
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=fed2984281a85a5a2f308841ec810f218c75f2ab tdf#82744: fix WebDAV lock/unlock behaviour - part 4 It will be available in 5.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=b4576f3da4d90139fc5140962d13cb91dab98797 tdf#82744: fix WebDAV lock/unlock behaviour - part 3 It will be available in 5.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
The daily builds contain the changes related to this issue starting with date Oct, 6th. As of today Linux, Windows and Mac builds are available. As soon as someone has spare time, can he/she try it? Thanks.
@Giuseppe: see https://freedomsponsors.org/issue/509/libreoffice-does-not-release-webdav-file-lock-on-document-close This bug is being sponsored, so it would be fair if you informed them on your fixing this and claimed your part of bounty
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/115edb7a91f0c1c9b2aeb343680f47924730d121 ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 1 It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Giuseppe Castagno committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/b5d91ff10fda72bc9758e7087f8a1a24d2d27022 ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 3 It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Michael Stahl committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a1ce00dad942b459dc145d4ac5ab1d02893fff0b ucb: webdav-curl: tdf#82744: fix WebDAV lock/unlock behaviour - part 4 It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.