Closed Bug 477248 Opened 15 years ago Closed 15 years ago

Calendar hangs - Syntax error calProviderUtils.jsm (new XML(...)) after opening outlook/lotus notes invitation mail

Categories

(Calendar :: E-mail based Scheduling (iTIP/iMIP), defect)

defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jeroen.hoet, Assigned: pgoerzen)

References

Details

Attachments

(4 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008122011 Iceweasel/3.0.5 (Debian-3.0.5-1)
Build Identifier: TB: version 3.0b2 (nightly 04/02/2009) + lightning 1.0pre (nightly 04/02/2009)

My setup consists of a caldav calendar, caching disabled, caldav sched disabled. Everything is working fine, even free/busy information.

After opening a calendar invitation email from outlook/lotus notes (and possibly other mail clients) and returning to the calendar, the calendar seems to have crashed. Adding a meeting doesn't show, invitation emails are not send out, free/busy stops working, calendar reload doesn't work,.... After restarting TB, the meetings that seem to have failed are visible, indicating that they were pushed to the server.

Looking at the error console (for every one of the previous actions there is a new entry): 
Error: syntax error
Source File: file:///users/hoet/.thunderbird/4ktqsdaf.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/modules/calProviderUtils.jsm
Line: 126

Piece of code at line 126:
cal.safeNewXML = function calSafeNewXML(aStr) {
    // Strip <?xml and surrounding whitespaces
    return new XML(aStr.replace(/^\s*<\?xml[^>]*>/g, "").trimRight());
};

This syntax error was also present in lightning 0.9, other files but same new XML() line. In 1.0pre this seems to have changed to one central function.

Reproducible: Always

Steps to Reproduce:
1.Start TB, check calendar/freebusy/... is working
2.Click on the mail with the outlook/lotus notes invitation to view it
3.Go back to the calendar and check freebusy/add appointment/...

Actual Results:  
Calendar is not showing free/busy times anymore (no information), syntax error showing in error console for each calendar action.
After restart of TB, all works again.

Expected Results:  
Keep working
This is the attachment from the outlook invitation that causes the calendar to stop responding.
Attachment #360908 - Attachment mime type: text/calendar → text/plain
Summary: Syntax error calProviderUtils.jsm (new XML(...)) after opening outlook/lotus notes invitation mail → Calendar hangs - Syntax error calProviderUtils.jsm (new XML(...)) after opening outlook/lotus notes invitation mail
jeroen, are you sure about the line?
The line could well be right, there tend to be "syntax error" messages if the xml passed to new XML() isn't correctly parseable xml. It would be helpful if you post the xml that was received/sent just before the error occurrs. Enable calendar.debug.log and calendar.debug.log.verbose and restart the app.
I am sure about the line Daniel. I found it a strange error myself, since syntax wise there should be nothing wrong with it. Especially since it works before opening the outlook/lotus notes invitation mail. 

I looked at the xml returned from the caldav server for adding a meeting and checking out free/busy times. In both cases (before and after the hang) the xml files are identical (except a DTSTAMP value). This is the output of the free/busy xml after the hang:

CalDAV: recv: <?xml version="1.0" encoding="UTF-8"?>

<C:schedule-response xmlns:C="urn:ietf:params:xml:ns:caldav">
  <C:response>
    <C:recipient>mailto:email@mailto.com</C:recipient>
    <C:request-status>2.0;Success</C:request-status>
    <C:calendar-data>BEGIN:VCALENDAR
METHOD:REPLY
VERSION:2.0
PRODID:Zimbra-Calendar-Provider
BEGIN:VFREEBUSY
ORGANIZER:mailto:email@mailto.com
ATTENDEE:mailto:email@mailto.com
DTSTAMP:20090211T101033Z
DTSTART:20090208T230000Z
DTEND:20090224T230000Z
FREEBUSY;FBTYPE=BUSY:20090209T090000Z/20090209T150000Z
FREEBUSY;FBTYPE=BUSY:20090211T080000Z/20090211T100000Z
FREEBUSY;FBTYPE=BUSY-TENTATIVE:20090213T120000Z/20090213T130000Z
FREEBUSY;FBTYPE=BUSY:20090213T153000Z/20090213T180000Z
FREEBUSY;FBTYPE=BUSY:20090214T090000Z/20090214T100000Z
FREEBUSY;FBTYPE=BUSY:20090216T100000Z/20090216T110000Z
FREEBUSY;FBTYPE=BUSY:20090216T150000Z/20090216T160000Z
FREEBUSY;FBTYPE=BUSY:20090217T160000Z/20090217T190000Z
FREEBUSY;FBTYPE=BUSY:20090218T080000Z/20090218T090000Z
FREEBUSY;FBTYPE=BUSY-TENTATIVE:20090220T120000Z/20090220T130000Z
FREEBUSY;FBTYPE=BUSY:20090221T100000Z/20090221T110000Z
FREEBUSY;FBTYPE=BUSY:20090223T150000Z/20090223T170000Z
END:VFREEBUSY
END:VCALENDAR
</C:calendar-data>
  </C:response>
</C:schedule-response>

I also tried to 'fix' the ics attachment and it seems that when both DESCRIPTION and PRIORITY are removed from the ics (outlook, see bug attachment), the calendar keeps working after opening this mail invitation.

Wireshark-wise I also do not see any differences...
I have the feeling that the parsing of the invitation mail screws up the environment somehow, causing new XML to give a syntax error. 

Kind regards,
Jeroen
I can confirm for CalDAV on Lightning 0.9 and Thunderbird 2.0.0.19 as well. Everything works properly until opening an email with an Outlook invitation (curse you, Outlook!). Then editing, adding, refreshing, etc. no longer works until restarting Thunderbird.

In 0.9, the error is at a couple different places. For adding/editing:
Error: syntax error
Source File: file:///home/pgoerzen/.mozilla-thunderbird/xxxxxxxx.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calDavCalendarModule.js -> file:///home/pgoerzen/.mozilla-thunderbird/xxxxxxxx.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/js/calDavCalendar.js
Line: 1195

For refreshing:
Error: syntax error
Source File: file:///home/pgoerzen/.mozilla-thunderbird/xxxxxxxx.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/components/calDavCalendarModule.js -> file:///home/pgoerzen/.mozilla-thunderbird/xxxxxxxx.default/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/js/calDavCalendar.js
Line: 1017

Thanks,
Peter
I just tested with Lightning 0.8, and the bug does not appear to exist in v0.8.
After a little more testing in v0.9, it appears that this bug is triggered by *any* email invitation containing a VEVENT DESCRIPTION field, regardless of sending client (apologies to Outlook). This is true even for invitations generated by Thunderbird/Lightning. VALARM DESCRIPTION fields appear to be acceptable.

Can anyone confirm this for Lightning 1.0pre?
As for lightning 1.0pre I have the impression that it is more 'stable'. Invitations from TB can be accepted most of the time, invitation replies (updates) work most of the time but not always. Outlook and lotus notes invites always result in the crash, that's why I use this as a test-case. 

It's always the same error though, and in fact the same error as you mensioned for 0.9. But in 0.9 the "new XML()" is all around the code where as for 1.0pre it is called in a common function.
The previous attachment contains the calendar log from adding an event before viewing an email with an invitation containing a DESCRIPTION. This attachment has the same for after viewing the email. The syntax error occurs immediately following this log. A diff of the files shows some indentation differences in the data the client sends to the server, but apparently nothing of consequence in what the server sends back.
OS: Linux → All
Hardware: x86 → All
When there is a DESCRIPTION or COMMENT field in an email invitation, linkifyText (lightningTextCalendarConverter.js) gets called, which modifies the ignoreWhiteSpace, prettyPrinting, and prettyIndent global properties of the XML namespace. This results in the syntax errors.

What's the best way to handle modifying global XML properties? Is there any risk of race conditions?

This patch saves off these properties and restores them before the function returns. This makes backporting to 0.9 easier, where there are several new XML() statements. However, this still makes assumptions when calling new XML() that the XML properties are in their default state. Perhaps safeNewXML should set the properties appropriately?
After browsing the E4X (ECMA-357) standard, I found some existing functions to use instead. The new patch also restores the defaults in safeNewXML. Lightning 0.9 users only need the changes in linkifyText.
Attachment #365427 - Attachment is obsolete: true
Attachment #365434 - Flags: review?(philipp)
Assignee: nobody → pgoerzen
Comment on attachment 365434 [details] [diff] [review]
Update to use E4X interface functions and safeguard safeNewXML

Nice find, looks like a very clean solution. r=phili[[

Do you think you could also file a bug with a patch to use safeNewXML everywhere we are currently using new XML() directly?
Attachment #365434 - Flags: review?(philipp) → review+
Thanks for the patch!

Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/07a97d5e80ca>

-> FIXED
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0
Works like a charm! Nice patch. Thanks!
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Blocks: 451027
Target Milestone: 1.0 → 1.0b1
You need to log in before you can comment on or make changes to this bug.