Bug 355441 - Akonadi DAV Resource: Broken state, The item was not deleted on the server.
Summary: Akonadi DAV Resource: Broken state, The item was not deleted on the server.
Status: REOPENED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: WebDAV (show other bugs)
Version: 5.43.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Dawit Alemayehu
URL:
Keywords:
: 362885 384130 386047 386136 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-16 18:36 UTC by Till Schäfer
Modified: 2023-09-19 14:31 UTC (History)
21 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Schäfer 2015-11-16 18:36:47 UTC
Whenever I delete a task in KOrganizer 15.08.3 the DAV Resource is broken afterwards: 

The status message is:
There was a problem with the request. The item has not been deleted from the server.
The file or folder the.domain.of.my.server does not exist. (0).

When I restart the resource in akonadiconsole a message box pops up with the message "Could not delete ."

Otherwise the synchronization works as expected. I can create new entries and modify them.

Reproducible: Always
Comment 1 Till Schäfer 2015-12-27 21:56:38 UTC
still valid for 15.12.0 release.
Comment 2 Grégory Oestreicher 2016-02-06 23:18:42 UTC
I can't reproduce this, it's working fine (tested against ownCloud 8.2.2 with the Tasks application). When this happens is your network up?
Comment 3 Till Schäfer 2016-02-07 15:19:41 UTC
i have reproduced this with 15.12.1 and davical server. it is always reproducible. Every single deletion leads to this error. 

Error message after akonadi restart is is now: "Error while trying to delete calendar item. Error was: No items found"

I will create a test account on my server and send you the credentials via mail. Maybe you can reproduce the error with this account.
Comment 4 Grégory Oestreicher 2016-02-07 16:13:54 UTC
Thanks Till! I can confirm that this is reproducible on my side with the account you created. I'll update this report after some more testing.
Comment 5 Grégory Oestreicher 2016-02-07 17:20:33 UTC
Good news, I found cause of the issue :)
Not-so-good news, the resource can't do much about it :(

What happens is that KIO HTTP adds a final slash at the end of the URL because when the delete job is created it's impossible to know if the deletion of what is requested is a directory or a file (full picture: it doesn't seem that the argument that would allow the slave to decide if the destination is a file or directory is ever appended in the KIO arguments).

I wasn't able to reproduce this with ownCloud because it's not sensitive to this. However Davical seems to be.

I'm re-assigning this to KIO to see what can be done. In the meantime you may be able to work around by removing the final slash in the URLs that end with ".ics/" (mod_rewrite FTW!).

Also, for me it's OK if you remove the test account.
Comment 6 David Faure 2016-02-08 07:58:14 UTC
Looks like a regression caused by 1bdb286f62454bb13cc299abd45a297a56b45cea
(the fix for bug 331295). Dawit?
Comment 7 Grégory Oestreicher 2016-02-08 13:17:12 UTC
(In reply to David Faure from comment #6)
> Looks like a regression caused by 1bdb286f62454bb13cc299abd45a297a56b45cea
> (the fix for bug 331295). Dawit?

This patch is not / no longer in master that's for sure. And even with it the problem is not really addressed as the final '/' will always be added.

The commit 58294ac mentions a fix coming from a discussion on the KDE forums. The original issue was that a 301 response was issued for DELETE requests against directories. AFAICS this is totally normal and the HTTP ioslave should follow the redirect and delete the resource pointed by the Location header, only if the new Location is the same as the previous one with just an extra '/' tacked on at the end. Otherwise just ignore it as it's potentially unsafe.

Also it's impossible to know in advance if a URI points to a file or directory because those concepts don't exist unfortunately :(
Comment 8 Till Schäfer 2016-02-10 15:03:50 UTC
It looks a bit suspicious to me, that the fix from bug 331295 is referencing KDE 4.12. However, the original issue of this report is reproducible on 15.12,. but not on 4.14. Therefore i doubt, that the concrete commit from bug 331295 is the cause. 

(Maybe i misunderstood some implications here)
Comment 9 David Faure 2016-02-13 10:28:39 UTC
You assume one version number for everything KDE produces ;-)

kdelibs is 4.14.x and stays that way. There is no "15.12" version numbering for kdelibs.
15.12 is an Applications release - which is based on kdelibs-4+Qt4 for some apps, and KF5+Qt5 for others.
Comment 10 Bruno Friedmann 2016-02-16 21:39:33 UTC
Don't know if it's 100% related : but not only delete is broken
After a migration from 4x series of pim stack which has seems to work, I only understood later than locally recorded event (new, delete and modified) were not pushed to the owncloud server.
QURL invalid ("") 

I backup my data, and delete the ressource and create it fresh. The setup worked, the caldav and carddav collections names and locations are founded, but not synchronisation occur.
in console log I can only see Kio jumbo frame 42649 received
and on the serveur client interrupt connection.
Comment 11 Dan 2016-05-04 15:05:33 UTC
Also applies to KF5 5.21 and KDEPim from 16.04. This is on Arch Linux and I am getting the exact same issue there for my CalDAV resources.
Comment 12 tasbeak 2016-08-03 15:34:18 UTC
I have the same problem deleting a task  using a davical resource. Creating and changing tasks seems to get properly synchronized. (This is also using KF5 5.21 on openSuSE 42.1)
Comment 13 Till Schäfer 2016-08-03 16:06:30 UTC
-> also the mod_rewrite trick did not help me: I do not get a broken state anymore, but whenever i delete an item, the deletion will silently fail on the server side and after this fail there is no more synchronization going on at all.
Comment 14 Till Schäfer 2016-08-19 12:46:46 UTC
ok, mod rewrite was my fault. It works with the following rule from Bug 362885 (which is a duplicate of this bug)

RewriteEngine On 
RewriteRule ^(.*\.[iv]cs)/$ $1 [L,PT]
Comment 15 Christophe Marin 2016-08-20 09:06:28 UTC
*** Bug 362885 has been marked as a duplicate of this bug. ***
Comment 16 Robert Schöftner 2016-08-21 18:08:25 UTC
actually,

RewriteRule ^(.*\.[iv]c[sf])/$   $1      [L,PT] 

or

RewriteRule ^(.*\.ics)/$   $1      [L,PT]
RewriteRule ^(.*\.vcf)/$   $1      [L,PT]

would be better, as it is either .ics or .vcf
Comment 17 Matthias Heinz 2017-05-16 10:31:02 UTC
Hey,

I've got the same bug with kdepim 16.04 and it would be great if this could be solved somehow. For now I guess I'll try the rewrite rules.
Comment 18 Lemmiwinks 2017-06-12 09:07:14 UTC
I have the same problem with my Davical resource.
The mod_rewrite rule seems to work. I hope this won't have affect other clients (Android, iOS, etc.).
I'm on Fedora 25, KDE Frameworks 5.33, KOrganizer 5.4.3.
A fix for this bug is really appreciated!
Comment 19 Fernando 2017-10-26 21:02:12 UTC
Still found in Kubuntu 17.10, Korganizer 5.5.3.
Comment 20 Fernando 2017-10-26 21:02:47 UTC
Still found in Kubuntu 17.10, Korganizer 5.5.3.
Comment 21 floppy5.25 2018-02-14 18:32:32 UTC
Another unhelpful "me too" 

This bug is still present in:
Arch Linux
KOrganizer Version 5.7.2
Akonadi Version 5.7.2
kio 5.42.0-1 (kf5)

and

Davical 1.1.5 on Debian 9

I can confirm that the Rewrite rule for Apache mentioned in Comment 16 solves de problem and does not break CalDav on an iphone client.
However I needed to remove and recreate the CalDav resource in Korganizer for things to work.
Comment 22 Antonio Rojas 2018-02-14 18:34:41 UTC
*** Bug 386136 has been marked as a duplicate of this bug. ***
Comment 23 Erik Quaeghebeur 2018-03-29 12:24:07 UTC
*** Bug 386047 has been marked as a duplicate of this bug. ***
Comment 24 Erik Quaeghebeur 2018-03-29 12:41:30 UTC
I can confirm again with more recent versions: frameworks 5.43 and kontact 17.12.3 (5.7.3).
Comment 25 Nate Graham 2018-08-22 21:20:38 UTC
*** Bug 384130 has been marked as a duplicate of this bug. ***
Comment 26 Daniel Vrátil 2018-09-23 16:17:19 UTC
Git commit 7615e3405c3083fe9601423e2c3e767423d7c9a8 by Daniel Vrátil.
Committed on 23/09/2018 at 16:17.
Pushed by dvratil into branch 'master'.

Fix deletion of files from DAV

Summary:
Don't append slash to the end of what we assume is a directory path as
in the case of HTTP we can't always tell for sure if it's a file or a
directory.

This partially restores change 1bdb286 from Dawit.
FIXED-IN: 5.51

Reviewers: dfaure

Reviewed By: dfaure

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D15697

M  +2    -6    src/ioslaves/http/http.cpp

https://commits.kde.org/kio/7615e3405c3083fe9601423e2c3e767423d7c9a8
Comment 27 Wulf 2018-10-16 17:16:38 UTC
Great work, Daniel - works here fine.
Comment 28 Wulf 2018-10-16 20:14:45 UTC
(In reply to Wulf from comment #27)
> Great work, Daniel - works here fine.

ok, this was to soon.

now I'm able to delete files; but not directories anymore.
as far as I remember, before the patch I was able to delete directories but not files. :-)

for me this happens on my own webserver (linux, apache)

I don't have and did not have this problem with a webdav-share at Vodafone.
weird
Comment 29 Wulf 2018-10-16 21:36:47 UTC
webserver access_log with Dolphin (doesn't work):

 - - [16/Oct/2018:23:33:35 +0200] "PROPFIND /webdav/test6 HTTP/1.1" 301 251
 - - [16/Oct/2018:23:33:35 +0200] "PROPFIND /webdav/test6/ HTTP/1.1" 207 1097
 - - [16/Oct/2018:23:33:44 +0200] "DELETE /webdav/test6 HTTP/1.1" 301 251

webserver access_log with TotalCommander/Android (works):
 - - [16/Oct/2018:23:36:07 +0200] "PROPFIND /webdav/test6/ HTTP/1.1" 207 844
 - - [16/Oct/2018:23:36:07 +0200] "DELETE /webdav/test6/ HTTP/1.1" 204 -
Comment 30 Wulf 2018-10-20 14:58:59 UTC
Gnome (gvfs?) just sends both:
"DELETE /webdav/test6"
"DELETE /webdav/test6/"
Comment 31 Andreas 2023-09-19 14:31:42 UTC
Years later I see the message reported by the OP with a Sogo WebDAV resource added to current KDE Neon (but I see it since at least half a year). 

Unfortunately, for me the issue appears to break the Akonadi agent which goes offline afterwards. Recreating the agent, deleting the cache etc. does not change anything. Although I know about akonadiconsole, I did not manage to debug the issue. Therefore, I had to stop using the calendar resource with korganizer. 

I was not able to verify that it related to a deleted task, but it could be.