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



10 years ago
9 years ago


(Reporter: jeroen.hoet, Assigned: pgoerzen)





(4 attachments, 1 obsolete attachment)



10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: 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

Comment 1

10 years ago
This is the attachment from the outlook invitation that causes the calendar to stop responding.
Attachment #360908 - Attachment mime type: text/calendar → text/plain


10 years ago
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.

Comment 4

10 years ago
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">

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,

Comment 5

10 years ago
I can confirm for CalDAV on Lightning 0.9 and Thunderbird 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


Comment 6

10 years ago
I just tested with Lightning 0.8, and the bug does not appear to exist in v0.8.

Comment 7

10 years ago
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?

Comment 8

10 years ago
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.

Comment 10

10 years ago
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.


10 years ago
OS: Linux → All
Hardware: x86 → All

Comment 11

10 years ago
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?

Comment 12

10 years ago
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 <>

Last Resolved: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.0

Comment 15

10 years ago
Works like a charm! Nice patch. Thanks!
Resolution: FIXED → ---


10 years ago
Last Resolved: 10 years ago10 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.