Closed Bug 603416 Opened 9 years ago Closed 8 years ago

startup crash [@ cal::UTC()]

Categories

(Calendar :: General, defect, critical)

Lightning 1.0b4
x86
Windows Vista
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wsmwk, Assigned: Fallen)

References

(Depends on 1 open bug)

Details

(Keywords: crash, topcrash, Whiteboard: [needed beta][no l10n impact])

Crash Data

Attachments

(1 file, 1 obsolete file)

crash [@ cal::UTC()]
~ #125 crash rank for thunderbird v3.1.4
approx 1/2 are startup crashes

bp-8287c4c3-a198-4083-a0d8-14de92101006
0	calbscmp.dll	cal::UTC	calendar/base/src/calUtils.h:143
1	calbscmp.dll	calDateTime::Reset	calendar/base/src/calDateTime.cpp:139
2	calbscmp.dll	calDateTime::calDateTime	calendar/base/src/calDateTime.cpp:67
3	calbscmp.dll	calDateTimeConstructor	calendar/base/build/calBaseModule.cpp:65
4	calbscmp.dll	nsGenericFactory::CreateInstance	xpcom/glue/nsGenericFactory.cpp:80
5	xpcom_core.dll	nsComponentManagerImpl::CreateInstance	xpcom/components/nsComponentManager.cpp:1597
6	thunderbird.exe	nsJSCID::CreateInstance	js/src/xpconnect/src/xpcjsid.cpp:821
7	xpcom_core.dll	NS_InvokeByIndex_P	xpcom/reflect/xptcall/src/md/win32/xptcinvoke.cpp:102
8	thunderbird.exe	XPCWrappedNative::CallMethod	js/src/xpconnect/src/xpcwrappednative.cpp:2722
9	thunderbird.exe	XPC_WN_CallMethod	js/src/xpconnect/src/xpcwrappednativejsops.cpp:1740
10	js3250.dll	js_Invoke	js/src/jsinterp.cpp:1360
11	js3250.dll	js_Interpret	js/src/jsops.cpp:2240
12	js3250.dll	js_Invoke	js/src/jsinterp.cpp:1368
13	js3250.dll	js_fun_apply	js/src/jsfun.cpp:2046
14	js3250.dll	js_Interpret	js/src/jsops.cpp:2208
15	js3250.dll	js_Invoke	js/src/jsinterp.cpp:1368
16	js3250.dll	js_InternalInvoke	js/src/jsinterp.cpp:1423
17	js3250.dll	JS_CallFunction	js/src/jsapi.cpp:5114
18	thunderbird.exe	nsJSContext::CallEventHandler	dom/base/nsJSEnvironment.cpp:2177
19	thunderbird.exe	nsJSEventListener::HandleEvent	dom/src/events/nsJSEventListener.cpp:269
20	thunderbird.exe	nsEventListenerManager::HandleEventSubType	content/events/src/nsEventListenerManager.cpp:1041

bp-c5e88d02-6cd5-40d5-b277-3936f2100927 has an email address
Version: unspecified → Lightning 1.0b2
141 inline nsCOMPtr<calITimezone> UTC() {
142 nsCOMPtr<calITimezone> tz;
143 getTimezoneService()->GetUTC(getter_AddRefs(tz)); 

according to the report, getTimezoneService() returned null
Hmm strange. I wonder how that happened. wsmwk, could you ask the reporter if there were any error console messages beforehand and if he can reproduce this bug?
I've posted to the user. No response yet.

no other crashes have email addresses. :(
Crash Signature: [@ cal::UTC()]
Unfortunately it seems this has become a topcrasher for 1.0b4. Can someone with a debugger reproduce this under windows?
Flags: blocking-calendar1.0+
Version: Lightning 1.0b2 → Lightning 1.0b4
I ran a crash stats mail campaign #61 asking for help with debug - it sent maybe 30 messages for 711 crash reports
Crash Signature: [@ cal::UTC()] → [@ cal::UTC()] [@ calbasecomps.dll@0x1b66]
Keywords: topcrash
Summary: crash [@ cal::UTC()] → startup crash [@ cal::UTC()]
I have a feeling this is some sort of reentrancy/initialization cycle bug, where https://mxr.mozilla.org/comm-central/source/calendar/base/src/calTimezoneService.js#112 in the timezone service constructor causes that UTC function to be called. Consider initializing it lazily.
FWIW, crashes go back at least as far as 1.0b1, per bp-326c7e84-f9ed-49f3-b98c-ef9252101022

bp-9131ccb2-84ad-4e3e-92b0-0dd922100611 comment is "using ctrl-shift-c to start Calendar"

ran socorro Campaign 62 https://crash-stats.mozilla.com/admin/email_campaign/62
Whiteboard: [needed beta][no l10n impact]
campaign 62 didn't email anyone due to current constraints for https://wiki.mozilla.org/PostCrash - so it is probably not possible to email any more until the system is revised (per rhelmer)
Here are the instructions for catching the stack trace in the debugger : https://developer.mozilla.org/en/how_to_get_a_stacktrace_with_windbg if you catch this please comment on the bug so fallen can ask you more information.
I'm not sure about comment 6 any more...

bp-8d63ede4-08a5-4282-8038-4a2792110707 is a 5.0 crash report -- the stack's somewhat different from the earlier ones, more involved.
This might be a broken stack though -- see bp-dd881af3-8da8-49c6-aa3c-aeacf2110707 -- don't see how one could jump from AddRef to js::Interpret...
So on a debug build, when typing top.opener.cal.getTimezoneService().UTC in the error console, I get 4 "undefined reference" messages and then the reult is correctly shown (linux). This could have to do with that.

I'll put up a patch that guards the c++ side of things from crashes and initializes the internal timezones lazily, lets see if it helps.
Attached patch Intermediate Fix - v1 (obsolete) β€” β€” Splinter Review
This patch won't save the user from a crash, but it will crash more controlled and notify the user why its crashing. It also includes lazily initializing UTC and floating, I'll test this on the other box that has the previously mentioned symptoms.
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Attachment #544761 - Flags: review?(mschroeder)
Ok, had access to my windows box now. I tried a few things, but couldn't reproduce with any of the following steps (all without the patch):

* Since this has to do with UTC, create an event in the UTC timezone
* Single alarm, recurring alarm, any alarm (in UTC) 
* Set CPU affinity to only one processor

I've also tested this patch on the debug build that produces "undefined reference"  messages (and then succeeds nevertheless!!?) but it didn't help.

I think the best we can do is apply the patch here and wait for crash feedback. Unless someone else can reliably reproduce this?
I found someone who has entered his Email in bp-c13bbd89-ae87-4f4d-93eb-f6d352110703 and have contacted him to receive more information.
Ok, I have another idea how we can fix this:

In the constructor to calDateTime.cpp, Reset() is called. This sets the timezone to UTC, which is very likely the reason for this crash. We could lazily initialize the timezone (i.e set to null and then add checks that set to UTC later on if null. I'll put up a patch that combines the above and this idea.
Attached patch Fix - v2 β€” β€” Splinter Review
Ok, this should take care. I'd appreciate anyones review so we can get this out of the door as fast as possible.

Also, I'd appreciate testing to make sure this doesn't break anything. Possible scenarios:

* Recurring events with alarms
* Recurring events with exceptions
* Events in local time (that should not become UTC events)
* Events in UTC
Attachment #544761 - Attachment is obsolete: true
Attachment #545133 - Flags: review?(mschroeder)
Attachment #544761 - Flags: review?(mschroeder)
Comment on attachment 545133 [details] [diff] [review]
Fix - v2

This looks good codewise! We should spin a RC with this fix included, and do a official call for testing. r=mschroeder
Attachment #545133 - Flags: review?(mschroeder) → review+
Pushed to comm-central <http://hg.mozilla.org/comm-central/rev/741351000bdf>
-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Trunk
Backported to comm-miramar <http://hg.mozilla.org/releases/comm-miramar/rev/13276b2cc970>
Target Milestone: Trunk → 1.0b5
The BOM I accidentally introduced with the above patch has been removed in various changesets.
My error console shows following messages directly after start up (with 1.0b5rc1 on Mac):

Warning: reference to undefined property getTimezoneService().defaultTimezone
Source File: chrome://calendar/content/calUtils.js
Line: 219

Warning: reference to undefined property getTimezoneService().defaultTimezone
Source File: resource://calendar/modules/calUtils.jsm -> file:///Users/mschroeder/Library/Thunderbird/Profiles/s4p58ovy.a-profile/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calUtils.js
Line: 219

Warning: reference to undefined property getTimezoneService().UTC
Source File: resource://calendar/modules/calUtils.jsm -> file:///Users/mschroeder/Library/Thunderbird/Profiles/s4p58ovy.a-profile/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calUtils.js
Line: 200

Warning: reference to undefined property getTimezoneService().floating
Source File: resource://calendar/modules/calUtils.jsm -> file:///Users/mschroeder/Library/Thunderbird/Profiles/s4p58ovy.a-profile/extensions/%7Be2fda1a4-762b-4020-b5ad-a41df1933103%7D/calendar-js/calUtils.js
Line: 208
The strict warnings appear all the time in 1.0b4 release and older nightly builds, i.e. they are not related to the patch in this bug. They will be repeated hundred times if you do some basic testing.
Yeah, I haven't found out why they appear, nor how to get them away. The funny thing is, if you evaluate the properties in the error console, the correct value is returned but the messages show up nevertheless.
Depends on: 675608
Depends on: 700827
You need to log in before you can comment on or make changes to this bug.