Last Comment Bug 752163 - Storage calendar events are not shown in views due to a corrupted event organizer
: Storage calendar events are not shown in views due to a corrupted event organ...
Status: RESOLVED FIXED
[wanted-1.2.x]
:
Product: Calendar
Classification: Client Software
Component: Provider: Local Storage (show other bugs)
: Lightning 1.4
: All All
: -- blocker (vote)
: 1.5
Assigned To: Matthew Mecca [:mmecca]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-04 23:15 PDT by Matthew Mecca [:mmecca]
Modified: 2012-05-25 20:51 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Fix v1 (3.40 KB, patch)
2012-05-12 15:31 PDT, Matthew Mecca [:mmecca]
mohit.kanwal: review+
philipp: approval‑calendar‑aurora+
philipp: approval‑calendar‑beta+
Details | Diff | Splinter Review
Clean Patch to apply on trunk (4.16 KB, patch)
2012-05-22 19:59 PDT, Mohit Kanwal [:redDragon]
no flags Details | Diff | Splinter Review
Clean Patch to apply on trunk (2.28 KB, patch)
2012-05-24 08:15 PDT, Mohit Kanwal [:redDragon]
no flags Details | Diff | Splinter Review

Description Matthew Mecca [:mmecca] 2012-05-04 23:15:16 PDT
In Lightning 1.4, sometimes events from a storage calendar are not being displayed in the views, with one of the following errors logged in the error console:

Error: org.id is null
Source File: resource://calendar/modules/calProviderUtils.jsm
Line: 857

or

Error: uncaught exception: [Exception... "'[JavaScript Error: "org.id is null" {file: "resource://calendar/modules/calProviderUtils.jsm" line: 857}]' when calling method: [calISchedulingSupport::isInvitation]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://calendar/content/calendar-view-core.xml :: setCSSClasses :: line 258" data: yes]

I beleive this is a due to the same regression reported in Bug 723610 and Bug 735619, in this case an item with an organizer was moved via the event dialog to a storage calendar without an email identity configured, resulting in an item with a corrupted organizer with a null id. From my testing it appears that the fix for Bug 735619 also fixed the root cause for this issue, but corrupted storage calendar items created in Lightning 1.2 and 1.3 may continue to prevent the views from displaying other storage calendar events properly.

I was able to reproduce the error on trunk with the following STR:
1) Backout the fix for Bug 735619
2) Create an item with an organizer on a non-storage calendar, in my test I used an event on a GData provider calendar
3) Set the email identity on a storage calendar to "None"
4) Open the event created in Step 2, change the calendar property to the storage calendar, Save and Close
5) Restart Thunderbird
6) Set the email identity on the storage calendar to an email address
6) Change the view date range to contain the event created in step 2. Disable and Enable the storage calendar. Change the view date range to another period and back.

Results:
The first error appears several times, no events from the storage calendar are shown in the view until Thunderbird is restarted. Skipping the step of disabling and enabling the calendar will sometimes cause some or all events to not be shown, and sometimes cause duplicate entries to be shown in the views.

The affected item has an associated row in the cal_attendees table with is_organizer set to true but attendee_id and common_name set to null.

Setting severity as critical as this can make a storage calendar mostly unusable for affected users. The default value for the email identity on a new calendar is usually the default email account, I do not believe that users with a valid email identity configured should have been affected.
Comment 1 Matthew Mecca [:mmecca] 2012-05-12 15:31:35 PDT
Created attachment 623460 [details] [diff] [review]
Fix v1

Skips corrupted attendees with a null id when reading items from storage, and also makes the isInvitation function more tolerant of the condition in case any other providers were affected.
Comment 2 Mohit Kanwal [:redDragon] 2012-05-14 18:06:00 PDT
Comment on attachment 623460 [details] [diff] [review]
Fix v1

Review of attachment 623460 [details] [diff] [review]:
-----------------------------------------------------------------

Looks okay to me. Will report once I can get the STR right. Setting + in the meanwhile.
Comment 3 Mohit Kanwal [:redDragon] 2012-05-16 18:16:36 PDT
Okay I am trying to reproduce the error using the STR described above. Where do I change the calendar property of the event created ? That is step number 4. Pardon me, to sound like a n00b but I don't know the lightning components in that much detail still learning :)
Comment 4 Matthew Mecca [:mmecca] 2012-05-16 19:50:39 PDT
(In reply to Mohit Kanwal [:redDragon] from comment #3)
> Where do I change the calendar property of the event created ?

Sorry, I should have clarified: open the event in the Edit Event dialog, and change the event's calendar using the Calendar dropdown, then Save and Close to move the event to the storage calendar.
Comment 5 Mohit Kanwal [:redDragon] 2012-05-22 19:57:58 PDT
Hi Matt,

I tested the patch with Lightning 1.2 and 1.3 and was able to reproduce the STR and managed to get the item to disappear from the view. After applying the patch, the item comes back to the view. However there is one additional issue, after updating lightning with the patch (Maybe I am doing this wrong, I am using xpi to add/remove add-ons while not touching the profile folder at all) . I get this error message, and I can no longer add events to my Google Calendar. 

Error: [Exception... "'TypeError: aItem.getProperty is not a function' when calling method: [calIOperationListener::onOperationComplete]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "JS frame :: resource://calendar/modules/calProviderUtils.jsm :: cPB_notifyOperationComplete :: line 694"  data: no]


It is possible that my method (using XPIs to install/remove add ons might have caused this, i am not sure about it maybe you can shed some light. 
Also I shall update the patch to apply cleanly on the current trunk vers 
 ion.
Comment 6 Mohit Kanwal [:redDragon] 2012-05-22 19:59:56 PDT
Created attachment 626298 [details] [diff] [review]
Clean Patch to apply on trunk
Comment 7 Matthew Mecca [:mmecca] 2012-05-23 06:43:08 PDT
(In reply to Mohit Kanwal [:redDragon] from comment #5)
> issue, after updating lightning with the patch (Maybe I am doing this wrong,
> I am using xpi to add/remove add-ons while not touching the profile folder
> at all) . I get this error message, and I can no longer add events to my
> Google Calendar. 

Did you do this test with a build from comm-central? If so could you try it with the patch for Bug 757332 applied? Also, did you update the Google Calendar Provider xpi as well as Lightning?
Comment 8 Mohit Kanwal [:redDragon] 2012-05-23 07:16:36 PDT
Yup i built it from comm-central updated about the same time i submitted the previous comment. Updated Google Calendar xpi as well as Lightning. I think I will try with the fix for bug 757332 applied. It is possible it may be broken coz of that, but so far works as expected for the purpose of this bug, ignoring the null value of the attendee_id column and displaying it correctly in the view which was missing with lightning 1.3.
Comment 9 Mohit Kanwal [:redDragon] 2012-05-23 17:11:56 PDT
After applying the fix for bug 757332 and rebuilding I can write events to my Google Calendar again.
Comment 10 Stefan Sitter 2012-05-23 22:31:13 PDT
Comment on attachment 626298 [details] [diff] [review]
Clean Patch to apply on trunk

This patch looks broken because it contains multiple but different diffs for the same file.
Comment 11 Stefan Sitter 2012-05-23 22:34:14 PDT
Comment on attachment 623460 [details] [diff] [review]
Fix v1

Problem was reported from 1.4 therefore it should be considered for the upcoming 1.5 release too.
Comment 12 Mohit Kanwal [:redDragon] 2012-05-24 08:15:01 PDT
Created attachment 626815 [details] [diff] [review]
Clean Patch to apply on trunk

Ok corrected, I think this should be the version.
Comment 13 Matthew Mecca [:mmecca] 2012-05-25 13:28:01 PDT
Pushed to comm-central - http://hg.mozilla.org/comm-central/rev/80217824a340
Comment 14 Philipp Kewisch [:Fallen] 2012-05-25 18:36:57 PDT
Comment on attachment 623460 [details] [diff] [review]
Fix v1

Yes, go ahead.
Comment 15 Matthew Mecca [:mmecca] 2012-05-25 19:58:55 PDT
Pushed to comm-aurora - http://hg.mozilla.org/releases/comm-aurora/rev/29c9c656e43c
Comment 16 Matthew Mecca [:mmecca] 2012-05-25 20:51:25 PDT
Pushed to comm-beta - http://hg.mozilla.org/releases/comm-beta/rev/b1271b77793a

Note You need to log in before you can comment on or make changes to this bug.