Bug 295469

Summary: Unable to fetch item from backend when using caldav resource connected to google
Product: [Frameworks and Libraries] Akonadi Reporter: David Hubner <hubn3rd>
Component: DAV ResourceAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: greg, heri+kde, karol.gro, lucabs2112, mfraz74+kde, RussellH
Priority: NOR    
Version: 4.9   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2
Sentry Crash Report:
Attachments: ics file

Description David Hubner 2012-03-07 13:58:07 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11
Build Identifier: 

I keep getting the error message "Unable to fetch item from backend" when loading the caldav resource. It is connected to google calender. 

Akonadi debug says:

330 UID FETCH 116 CACHEONLY ANCESTORS INF EXTERNALPAYLOAD (UID REMOTEID REMOTEREVISION COLLECTIONID FLAGS SIZE DATETIME) 
* 116 FETCH (UID 116 REV 0 REMOTEID "https://www.google.com/calendar/dav/<username>/events/u8u40h962cmofut1fhsgku7f8g@google.com.ics" MIMETYPE "application/x-vnd.akonadi.calendar.event" COLLECTIONID 10 SIZE 0 DATETIME "07-Mar-2012 13:18:02 +0000" REMOTEREVISION "\"63462735646\"" FLAGS () ANCESTORS ((10 "https://www.google.com/calendar/dav/<username>/events/") (9 "akonadi_davgroupware_resource_10") (0 ""))) 
330 OK UID FETCH completed 

AgentBase(akonadi_davgroupware_resource_10): The server returned invalid data

Replaced email address with <username>

The akonadiserver.error log says 

ItemRetrieverException :  Resource was unable to deliver item 

Reproducible: Always

Steps to Reproduce:
1.Create Calender using caldav resource and connected to google account
2.Open KOrganizer
Actual Results:  
Get Error "Unable to fetch item from backend"

Expected Results:  
Fetching caldav entries
Comment 1 Grégory Oestreicher 2012-03-07 14:03:26 UTC
Hi,

Which KDE version are you using?

Cheers,
Grégory
Comment 2 David Hubner 2012-03-07 14:12:56 UTC
Hi, 

I am using the KDE 4.8

Thanks
Comment 3 Grégory Oestreicher 2012-03-07 14:34:26 UTC
Hi,

Apparently there's a problem to parse the event retrieved from the calendar. Can you share it with me (you can of course redact user names and email addresses)?

Cheers,
Grégory
Comment 4 David Hubner 2012-03-07 16:31:46 UTC
Hi,

I have shared the calender. Please be gentle as its my work calender. I shall have to remove the invite in a couple of days

You should have got the invite 

Thanks
Comment 5 Grégory Oestreicher 2012-03-07 18:08:03 UTC
Hi David,

I think there must have been a slight misunderstanding. You don't have to share me your whole calendar; I just need the single event that fails to parse (the one with URL https://www.google.com/calendar/dav/<username>/events/u8u40h962cmofut1fhsgku7f8g@google.com.ics). You can redact the names and email addresses, but try to preserve as much of the fields as you can. For example if in the event you have a person declared as "John Smith <jsmith@company.com>" you can change it to "XXXXXX YYYYYY <invalid@domain.com>".

On a side note I don't know how Google accepted this email address, as I don't have an account with this one.

Cheers,
Grégory
Comment 6 David Hubner 2012-03-08 09:34:42 UTC
Created attachment 69362 [details]
ics file

Hi sorry, little bit of a brainfart there. Thought your email said gmail for some reason. 

Attached is the ics with my email addy replaced as <username>

Thanks
Comment 7 Grégory Oestreicher 2012-03-08 11:58:18 UTC
Hi David,

Thanks for the event. I've been quite surprised to see that it's in fact empty, save for timezone and daylight declarations.

Can you confirm that you see your events normally? If that's the case then this error just pops up for this one, and doesn't block normal fetching. It's annoying though, so I'll try to find a way to mute it for these cases.

Cheers,
Grégory
Comment 8 David Hubner 2012-03-08 12:02:58 UTC
Nope, cannot see any events at all. Seems to stop downloading on first error. 

Thanks
Comment 9 Grégory Oestreicher 2012-03-08 14:01:24 UTC
This is weird, it should fetch events correctly. I'll have a look at this this weekend now that I have an event to import.

Cheers,
Grégory
Comment 10 Grégory Oestreicher 2012-03-09 23:22:06 UTC
Git commit 16050772b6be2fa49d51fd9e35d0ba986353026e by Gregory Oestreicher.
Committed on 10/03/2012 at 00:16.
Pushed by goestreicher into branch 'KDE/4.8'.

Check the ETag cache for items presence
FIXED-IN: 4.8.2

(cherry picked from commit 183f97607445c0afb371e1f30092b9ab0b60a527)

M  +5    -0    resources/dav/common/etagcache.cpp
M  +5    -0    resources/dav/common/etagcache.h
M  +1    -1    resources/dav/resource/davgroupwareresource.cpp

http://commits.kde.org/kdepim-runtime/16050772b6be2fa49d51fd9e35d0ba986353026e
Comment 11 Mark Fraser 2012-05-10 09:45:57 UTC
This was fixed in 4.8.2, but this morning I've started to get lots of these errors when syncing with Google via CalDAV.
Comment 12 Mark Fraser 2012-07-04 08:27:49 UTC
Still seeing these errors with KDE 4.9 beta 2.
Comment 13 Luca 2012-07-04 08:54:11 UTC
This is still present in KDE 4.8.4 when syncing Google Calendar in KOrganizer via CalDAV.
Comment 14 Karol 2012-08-19 13:44:16 UTC
Same for me (4.8.4, Google Calendar, CalDAV). Error is shown when entering KOrganizer and on KDE start (I have a calendar widget).
Comment 15 Myriam Schweingruber 2012-08-19 18:41:36 UTC
Reopening, based on comments #12, 13 and 14
Comment 16 Karol 2012-09-22 09:42:35 UTC
(In reply to comment #14)
> Same for me (4.8.4, Google Calendar, CalDAV). Error is shown when entering
> KOrganizer and on KDE start (I have a calendar widget).

In 4.8.5 the problem still exists.
Comment 17 Dennis Schridde 2012-10-04 23:10:19 UTC
I experience the same in KDE 4.9.2 upon login. The message being displayed is "Unable to fetch item from backend (collection 317, resource -1)" (see bug #305896).

Please note that I also get *a lot* of these message on the console (after running akonadictl restart):
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: Failed to parse incidence! Item id =  111587 Storage collection id  317 parentCollectionId =  -689 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: "" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Unable to deserialize payload part: "RFC822" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Payload data was:  "" 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: Failed to parse incidence! Item id =  111586 Storage collection id  317 parentCollectionId =  -690 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: "" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Unable to deserialize payload part: "RFC822" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Payload data was:  "" 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: Failed to parse incidence! Item id =  111585 Storage collection id  317 parentCollectionId =  -691 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: "" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Unable to deserialize payload part: "RFC822" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Payload data was:  "" 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: Failed to parse incidence! Item id =  111584 Storage collection id  317 parentCollectionId =  -692 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: "" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Unable to deserialize payload part: "RFC822" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Payload data was:  "" 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: Failed to parse incidence! Item id =  111583 Storage collection id  317 parentCollectionId =  -693 
akonadi_davgroupware_resource_0(16970)/akonadiserializer (calendar) Akonadi::SerializerPluginKCalCore::deserialize: "" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Unable to deserialize payload part: "RFC822" 
akonadi_davgroupware_resource_0(16970)/libakonadi Akonadi::ItemSerializer::deserialize: Payload data was:  ""

Please see bug #295532, where someone else experiences the same messages
Comment 18 Grégory Oestreicher 2012-10-17 20:08:09 UTC
Hi Dennis,

It would help me debug the problem if you could you have a look at the items.

It's a multi-step process:
- Start 'akonadiconsole'.
- Go in the "Browser" tab, unfold the resource, then select the calendar to view the items it contains.
- Look for an item whose 'id' is one of those you have in the error message (111583, 111584, 111585, 111586, 111587).
- The item 'remote id' (second column) is the URL of the .ics file, open this URL in your web browser and download the file. If you have an error here I'm interested to hear about it too :)
- Anonymize it, but please try to preserve as much of it as you can.

Then you can attach the file to this bug report, I'll have a look at it and try to see what the problem is.

Cheers,
Grégory
Comment 19 Dennis Schridde 2012-10-17 22:21:05 UTC
Thanks for your detailed description!

(In reply to comment #18)
> - Go in the "Browser" tab, unfold the resource, then select the calendar to
> view the items it contains.
Is the calendar usually displayed with an IMAP-Server icon? I have an IMAP account with the name "Google", something that contains contacts with the name "Google" and something that contains nothing with my GMail address as the name. All of them carry IMAP-Server icon.
Comment 20 Grégory Oestreicher 2012-10-18 04:53:51 UTC
(In reply to comment #19)
> Is the calendar usually displayed with an IMAP-Server icon?

Nope, the resource icon is a blue folder with a little earth on it in the lower right.

> I have an IMAP
> account with the name "Google", something that contains contacts with the
> name "Google" and something that contains nothing with my GMail address as
> the name. All of them carry IMAP-Server icon.

Eventually send a screenshot of the browser tab.

Cheers,
Grégory
Comment 21 Dennis Schridde 2012-10-18 08:17:52 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > Is the calendar usually displayed with an IMAP-Server icon?
> Nope, the resource icon is a blue folder with a little earth on it in the
> lower right.
Sorry, got fixed on the Google calendar, probably because of the Summary.

My Yahoo calendar, which apparently contains the failing items, contains no number in the range of 111000. All IDs are above 113000.
Comment 22 Dennis Schridde 2012-10-18 08:35:25 UTC
Maybe this is related (got it when running akondictl restart on the console again):
Error during executing query "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, cachePolicyInherit) VALUES (:0, :1, :2, :3, :4, :5)" :  "Duplicate entry '10-My Contacts' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
akonadi_davgroupware_resource_0(29490): Can't find a configured URL, collection.remoteId() is  "akonadi_davgroupware_resource_0" 
akonadi_davgroupware_resource_0(29490): Can't find a configured URL, collection.remoteId() is  "akonadi_davgroupware_resource_0" 
akonadi_davgroupware_resource_0(29490): Can't find a configured URL, collection.remoteId() is  "akonadi_davgroupware_resource_0" 
akonadi_davgroupware_resource_0(29490): Can't find a configured URL, collection.remoteId() is  "akonadi_davgroupware_resource_0" 
akonadi_davgroupware_resource_0(29490): Can't find a configured URL, collection.remoteId() is  "akonadi_davgroupware_resource_0"
Comment 23 Grégory Oestreicher 2012-10-18 08:46:11 UTC
(In reply to comment #22)
> Maybe this is related (got it when running akondictl restart on the console
> again):
> Error during executing query "INSERT INTO CollectionTable (remoteId,
> remoteRevision, name, parentId, resourceId, cachePolicyInherit) VALUES (:0,
> :1, :2, :3, :4, :5)" :  "Duplicate entry '10-My Contacts' for key
> 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"

Not sure why this would pop up, but shouldn't be an issue.

> akonadi_davgroupware_resource_0(29490): Can't find a configured URL,
> collection.remoteId() is  "akonadi_davgroupware_resource_0" 

Nope, not related to the deserialization issue. This has been reported in https://bugs.kde.org/show_bug.cgi?id=307746, and the fix will be shipped with 4.9.3.

Cheers,
Grégory
Comment 24 Grégory Oestreicher 2012-10-18 08:53:27 UTC
(In reply to comment #21)
> My Yahoo calendar, which apparently contains the failing items, contains no
> number in the range of 111000. All IDs are above 113000.

Do you have something else than a calendar in this resource, such as an addressbook? An can you find these items in other resources?

Cheers,
Grégory
Comment 25 Dennis Schridde 2012-10-18 10:31:17 UTC
(In reply to comment #24)
> Do you have something else than a calendar in this resource, such as an
> addressbook?
There are 2 contact collections and 2 calendar collections in there. But only one calendar contains anything (113000+ IDs).

> An can you find these items in other resources?
How do I search for the IDs?

The output of akonadictl restart does no longer contain the "Failed to parse incidence! Item id" messages anymore, at this time.
Comment 26 Grégory Oestreicher 2012-10-18 17:13:24 UTC
In akonadiconsole you have the 'DB Browser' tab. Select the 'pimitemtable' from the drop down menu. However if you can't find them in the 'Browser' tab they must have been re-created with a new ID.

Cheers,
Grégory
Comment 27 Grégory Oestreicher 2012-10-20 21:50:50 UTC
Could the Google calendar users test 4.9.3 once it's out (November 6th) and update this bug report? Google errors should be addressed I hope.