Bug 489654

Summary: KOrganizer lost all calendars from DAV resource, but kept one event locally
Product: [Frameworks and Libraries] frameworks-kdav Reporter: Szőts Ákos <akos+kde>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: REPORTED ---    
Severity: normal CC: kdedev, postix
Priority: NOR    
Version First Reported In: 6.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Szőts Ákos 2024-07-03 06:56:42 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY

I have a remote CalDAV resource (with multiple calendars) set up and it worked nicely up until today. 

Currently, KOrganizer doesn't show any of the previous events and tasks, but only one, which was created within KOrganizer itself recently (with one of the calendars). That one is not synced to the remote resource.

"Calendar properties" within KOrganizer shows proper "Server Configuration", and re-downloading from the URL properly displays the calendars contained within.

"Folder Properties" of a calendar shows that "Total items" are zero for all calendars, except for the one which contains the single shown event, where it's 1.

Updating one calendar emit the following information in the terminal:

kf.dav: "https://xxxxx/yy_user_yy/xcalendarx/" PRIVS:  QFlags(0x1|0x2|0x4|0x8|0x400)
org.kde.pim.akonadicore: localListDone:  false  deliveryDone:  true
org.kde.pim.akonadicore: localListDone:  true  deliveryDone:  true
org.kde.pim.akonadicore: Nothing to do
org.kde.pim.akonadiagentbase: Preparing collection sync of collection 21 "XCALENDARX"
org.kde.pim.davresource: Retrieving items for collection  "https://xxxxx/yy_user_yy/xcalendarx/"
org.kde.pim.davresource: CTag for collection "https://xxxxx/yy_user_yy/xcalendarx/" didn't change:  "\"80fc84800cfa4f66444afcea1316c5d0c0d6ca584ed39a0fab11baff616e355e\""

While on the server it logs:

PROPFIND request for '/yy_user_yy/' with depth '1' received from 46.142.164.50 using 'Mozilla/5.0 (X11; Linux x86_64) KIO/6.1 akonadi_davgroupware_resource_2/6.0.2 (24.02.2)'
Successful login: 'yy_user_yy'
PROPFIND response status for '/yy_user_yy/' with depth '1' in 0.141 seconds: 207 Multi-Status

Debug output from Akonadi:

<- akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestorsAttributes": [
    ],
    "ancestorsDepth": 2,
    "collections": {
        "type": "UID",
        "value": "21"
    },
    "depth": 0,
    "displayPref": false,
    "enabled": false,
    "fetchStats": false,
    "indexPref": false,
    "mimeTypes": [
    ],
    "resource": "akonadi_davgroupware_resource_2",
    "response": false,
    "syncPref": true,
    "tag": 158,
    "type": "FetchCollections"
}

-> akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestors": [
        {
            "attributes": {
            },
            "id": 15,
            "name": "akonadi_davgroupware_resource_2",
            "remoteId": "akonadi_davgroupware_resource_2"
        },
        {
            "attributes": {
            },
            "id": 0,
            "name": "",
            "remoteId": ""
        }
    ],
    "attributes": {
        "AccessRights": "a",
        "ENTITYDISPLAY": "(\"XCALENDARX\" \"\" \"\" ())",
        "collectioncolor": "#ff00ff00",
        "ctag": "\"80fc84800cfa4f66444afcea1316c5d0c0d6ca584ed39a0fab11baff616e355e\"",
        "davprotocol": "0"
    },
    "cachePolicy": {
        "cacheTimeout": -1,
        "checkInterval": 5,
        "inherit": true,
        "localParts": [
            "ALL"
        ],
        "syncOnDemand": false
    },
    "displayPref": "Undefined",
    "enabled": true,
    "error": false,
    "id": 21,
    "indexPref": "Undefined",
    "isVirtual": false,
    "mimeTypes": [
        "application/x-vnd.akonadi.calendar.event",
        "application/x-vnd.akonadi.calendar.todo",
        "application/x-vnd.akonadi.calendar.journal",
        "inode/directory"
    ],
    "name": "https://xxxxx/yy_user_yy/xcalendarx/",
    "parentId": 15,
    "remoteId": "https://xxxxx/yy_user_yy/xcalendarx/",
    "remoteRevision": "",
    "resource": "akonadi_davgroupware_resource_2",
    "response": true,
    "searchCollections": [
    ],
    "searchQuery": "",
    "statistics": {
        "count": 0,
        "error": false,
        "response": true,
        "size": 0,
        "type": "FetchCollectionStats",
        "unseen": 0
    },
    "syncPref": "Undefined",
    "tag": 158,
    "type": "FetchCollections"
}

-> akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestors": [
    ],
    "attributes": {
    },
    "cachePolicy": {
        "cacheTimeout": -1,
        "checkInterval": -1,
        "inherit": true,
        "localParts": [
        ],
        "syncOnDemand": false
    },
    "displayPref": "Undefined",
    "enabled": true,
    "error": false,
    "id": -1,
    "indexPref": "Undefined",
    "isVirtual": false,
    "mimeTypes": [
    ],
    "name": "",
    "parentId": -1,
    "remoteId": "",
    "remoteRevision": "",
    "resource": "",
    "response": true,
    "searchCollections": [
    ],
    "searchQuery": "",
    "statistics": {
        "count": 0,
        "error": false,
        "response": true,
        "size": 0,
        "type": "FetchCollectionStats",
        "unseen": 0
    },
    "syncPref": "Undefined",
    "tag": 158,
    "type": "FetchCollections"
}

<- akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestorsAttributes": [
    ],
    "ancestorsDepth": 2,
    "collections": {
        "type": "UID",
        "value": "21"
    },
    "depth": 0,
    "displayPref": false,
    "enabled": true,
    "fetchStats": false,
    "indexPref": false,
    "mimeTypes": [
    ],
    "resource": "",
    "response": false,
    "syncPref": false,
    "tag": 159,
    "type": "FetchCollections"
}

-> akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestors": [
        {
            "attributes": {
            },
            "id": 15,
            "name": "akonadi_davgroupware_resource_2",
            "remoteId": "akonadi_davgroupware_resource_2"
        },
        {
            "attributes": {
            },
            "id": 0,
            "name": "",
            "remoteId": ""
        }
    ],
    "attributes": {
        "AccessRights": "a",
        "ENTITYDISPLAY": "(\"XCALENDARX\" \"\" \"\" ())",
        "collectioncolor": "#ff00ff00",
        "ctag": "\"80fc84800cfa4f66444afcea1316c5d0c0d6ca584ed39a0fab11baff616e355e\"",
        "davprotocol": "0"
    },
    "cachePolicy": {
        "cacheTimeout": -1,
        "checkInterval": 5,
        "inherit": true,
        "localParts": [
            "ALL"
        ],
        "syncOnDemand": false
    },
    "displayPref": "Undefined",
    "enabled": true,
    "error": false,
    "id": 21,
    "indexPref": "Undefined",
    "isVirtual": false,
    "mimeTypes": [
        "application/x-vnd.akonadi.calendar.event",
        "application/x-vnd.akonadi.calendar.todo",
        "application/x-vnd.akonadi.calendar.journal",
        "inode/directory"
    ],
    "name": "https://xxxxx/yy_user_yy/xcalendarx/",
    "parentId": 15,
    "remoteId": "https://xxxxx/yy_user_yy/xcalendarx/",
    "remoteRevision": "",
    "resource": "akonadi_davgroupware_resource_2",
    "response": true,
    "searchCollections": [
    ],
    "searchQuery": "",
    "statistics": {
        "count": 0,
        "error": false,
        "response": true,
        "size": 0,
        "type": "FetchCollectionStats",
        "unseen": 0
    },
    "syncPref": "Undefined",
    "tag": 159,
    "type": "FetchCollections"
}

-> akonadi_davgroupware_resource_2 (0x559e7be8f4d0) {
    "ancestors": [
    ],
    "attributes": {
    },
    "cachePolicy": {
        "cacheTimeout": -1,
        "checkInterval": -1,
        "inherit": true,
        "localParts": [
        ],
        "syncOnDemand": false
    },
    "displayPref": "Undefined",
    "enabled": true,
    "error": false,
    "id": -1,
    "indexPref": "Undefined",
    "isVirtual": false,
    "mimeTypes": [
    ],
    "name": "",
    "parentId": -1,
    "remoteId": "",
    "remoteRevision": "",
    "resource": "",
    "response": true,
    "searchCollections": [
    ],
    "searchQuery": "",
    "statistics": {
        "count": 0,
        "error": false,
        "response": true,
        "size": 0,
        "type": "FetchCollectionStats",
        "unseen": 0
    },
    "syncPref": "Undefined",
    "tag": 159,
    "type": "FetchCollections"
}

Just a minute ago one of the calendars got populated in KOrganizer, the rest still missing their events.

The difference is that the still-wrong calendars say that "CTag for collection "https://xxxxx/yy_user_yy/<calendar names>/" didn't change". The one which got "resurrected" started to sync, it didn't print the CTag line:

org.kde.pim.akonadiagentbase: Preparing collection sync of collection 20 "ZCALENDARZ"
org.kde.pim.davresource: Retrieving items for collection  "https://xxxxx/yy_user_yy/zcalendarz"

Operating System: openSUSE Tumbleweed 20240418
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.6-1-default (64-bit)
Graphics Platform: X11
Comment 1 Szőts Ákos 2024-07-03 07:01:14 UTC
Upon closer inspection "Updating calendar" doesn't really work.

When calendars are automatically refreshed the following is printed out:

kf.kio.core: killing worker process pid 10497 ( "https://xxxxx" )
org.kde.pim.davresource: Retrieving collections list
org.kde.pim.akonadiserver: Database "/home/zzz/.local/share/akonadi/akonadi.db" opened using driver "QSQLITE"
kf.kio.core.connection: Got a new connection

This time the server properly responds with:
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:CS="http://calendarserver.org/ns/" xmlns:ICAL="http://apple.com/ns/ical/">
....
<CS:getctag>...

XML response. CTags within are there and match the one from Akonadi.

When I click on one of the calendars and select "Update Folder" Akonadi says:
CTag for collection "https://xxxxx/yy_user_yy/xcalendarx/" didn't change:  "\"80fc84800cfa4f66444afcea1316c5d0c0d6ca584ed39a0fab11baff616e355e\""

However, the server didn't receive or send any communication.