Closed Bug 388221 Opened 19 years ago Closed 19 years ago

Repeating events - alarm doesn't always fire

Categories

(Calendar :: Alarms, defect)

Sunbird 0.5
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tikva1, Assigned: dbo)

References

Details

(Keywords: dataloss, regression)

Attachments

(1 file, 5 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 Build Identifier: Sunbird 0.5 After upgrading from 0.3 to 0.5, I discovered that the alarms for pre-existing repeating events weren't firing. I recreated these events from scratch; now the alarms fire *sometimes* (I created two test events yesterday; yesterday both fired, today only one fired). In addition, even though my default setting is "alarm on," if I look at the event dialog for these repeating events after creating them, they all say "no alarm." (This includes the ones that actually fired.) Reproducible: Always Steps to Reproduce: 1. create a repeating event, with alarm on. 2. check dialog - says "no alarm." 3. wait to see if alarm fires anyway. Actual Results: see above Expected Results: Repeating event dialogs should show the alarm, and it should fire consistently.
Version: unspecified → Sunbird 0.5
Confirming that alarms of recurring events do not fire properly (STORAGE + ICS) in Sunbird 0.5. This is a regression from SB 0.3.1; users who upgraded to SB 0.5 may miss their appointments. Once more the steps to reproduce: 1. Create a recurring event and set an alarm. 2. Relaunch Sunbird and wait for the alarm popup. Actual results: Alarm doesn't fire. Alarms only work as expected if a) the recurring event was created during the current session or b) you already dismissed or snoozed an alarm of this series during the current session. Missed alarm fires after a) relaunch of Sunbird or b) editing the event. No errors are shown in the Error Console. Problem is still present in current nightlies (tested with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5pre) Gecko/20070715 Calendar/0.7pre). It reminds of https://bugzilla.mozilla.org/show_bug.cgi?id=382840, but for recurring events and also storage provider is affected (not only ICS). Reopen that one?
(In reply to comment #1) > Bug 382840, but for recurring events and also storage provider > is affected (not only ICS). Reopen that one? No, because you are reporting a different issue and Bug 382840 is fixed and verified.
I can confirm this using Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.5pre) Gecko/20070715 Calendar/0.7pre. It seems that this issue happens only if more than one occurrence of the repeating event is checked for alarms. I tested with two events: A monthly repeating event and a daily repeating event: -------------------------------------------------------------- Repeating event / 15.07 / 18:30 UTC / Monthly -------------------------------------------------------------- Console shows: *** Calendar schema version is: 7 Starting calendar alarm service observer added snooze time is:null considering alarm for item:Repeating event / 15.07 / 18:30 / Monthly offset:-PT15M, which makes alarm time:2007/07/15 18:15:00 UTC now is 2007/07/15 18:10:11 UTC alarm is in the future adding alarm timeout (289000) for [xpconnect wrapped (nsISupports, calIItemBase, calIEvent, calIInternalShallowCopy, nsIClassInfo)] --> Alarm fires at correct time -------------------------------------------------------------- Repeating Event / 15.07 / 18:30 UTC / Daily every second day -------------------------------------------------------------- Console shows: *** Calendar schema version is: 7 Starting calendar alarm service observer added snooze time is:null considering alarm for item:Repeating Event / 15.07 / 18:30 / Daily offset:-PT10M, which makes alarm time:2007/07/15 18:20:00 UTC now is 2007/07/15 18:18:51 UTC alarm is in the future adding alarm timeout (69000) for [xpconnect wrapped (nsISupports, calIItemBase, calIEvent, calIInternalShallowCopy, nsIClassInfo)] snooze time is:null considering alarm for item:Repeating Event / 15.07 / 18:30 / Daily offset:-PT10M, which makes alarm time:2007/07/17 18:20:00 UTC now is 2007/07/15 18:18:51 UTC alarm is in the future alarm is too late --> No alarm is fired althought there is an timer started for the alarm
Status: UNCONFIRMED → NEW
Ever confirmed: true
I haven't done any testing to confirm, but I strongly suspect the (first) patch in Bug 382840 is responsible for the behavior ssitter is seeing. If two occurrences are returned from the getItems() call, the alarm for the second will replace the first due to this change: onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItems) { for (var i = 0; i < aCount; ++i) { var item = aItems[i]; + // assure we don't fire alarms twice, handle removed alarms as far as we can: + // e.g. we cannot purge removed items from ics files. XXX todo. + this.alarmService.removeAlarm(item); Adding dataloss keyword consistent with other alarm failure bugs (e.g. bug 329985)
Keywords: dataloss, regression
Confirmed as regession from Bug 382840 (using Storage provider): Works in sunbird-0.5.en-US.win32-2007-06-10-05-mozilla1.8 Fails in sunbird-0.5.en-US.win32-2007-06-11-05-mozilla1.8 Checkins between 2007-06-10 05:00 and 2007-06-11 06:00 : Bug 382840, Bug 340949 [http://tinyurl.com/39f29k]
Blocks: 382840
Flags: blocking-calendar0.7?
This is a rather ugly approach but it works well for me. When storing the alarm timeout we also evaluate the Recurrence-Id for the event. This ensures that we add/replace/remove the alarm timeout for the correct occurrence of the repeating event later.
Attachment #272547 - Flags: review?(daniel.boelzle)
I agree, the alarm management lacks to incorporate the RECURRENCE-ID when storing the timers. However, I don't agree with the patch, because UIDs are freestyle, thus we may run into conflicts by just concatenating (I suspect you called it pseudoId for that reason). Thinking further, I potentially see the same problem as stated in bug 363441, thus I think we should approach for a general helper function, e.g. function getUniqueId(item) { var id = encodeUriComponent(item.id); var recurrenceId = item.recurrenceId; if (recurrenceId) { id += "#"; // some unused delim character id += recurrenceId.getInTimezone("UTC").icalString; } id += "#"; // some unused delim character id += encodeUriComponent(item.calendar.id) return id; } Opinions?
Flags: blocking-calendar0.7? → blocking-calendar0.7+
Attachment #272547 - Flags: review?(daniel.boelzle) → review-
Same solution as in previous patch but with the modifications proposed in Comment #7.
Assignee: nobody → ssitter
Attachment #272547 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #273032 - Flags: review?(daniel.boelzle)
I assume that hashed id will be computed lots of times in the views (bug 363441), thus I'd prefer to add e.g. calIItemBase::hashId which could hold the computed value. Setting calIItemBase:id, calIItemBase::recurrenceId or calIItemBase:calendar must invalidate the stored hash to be recomputed. What do you think of that? Sorry, I haven't thought of that in the first place and haven't expected that you are rewriting the patch that quickly ;)
Comment on attachment 273102 [details] [diff] [review] sketched calItemBase pieces, untested ... >+ id += encodeUriComponent(cal.id); >+ } >+ this.mHashId = id; >+ } >+ return id; return this.mHashId;
Attached patch incorporating fixes from ssitter (obsolete) — — Splinter Review
@Stefan: could you please do a first review and further testing on the patch, please?
Attachment #273102 - Attachment is obsolete: true
Attachment #273228 - Flags: review?(philipp)
Basically we run into the same problem mentioned in Bug 348144 although it now applies to all occurrences because of the changes from Bug 382840. During testing with my patch I found another issue: onAddItem() in calAlarmService works on single occurrences. But onDeleteItem() only works on the parent item but not on single occurrences. Previously this was no problem because the alarms were just stored based on the id. With the patch taking the recurrence id into account onDeleteItem() will fail to remove the alarm timeout if you remove or modify a repeating event.
Attachment #273032 - Attachment is obsolete: true
Attachment #273032 - Flags: review?(daniel.boelzle)
Assignee: ssitter → daniel.boelzle
Status: ASSIGNED → NEW
(In reply to comment #13) > onAddItem() in calAlarmService works on single occurrences. But onDeleteItem() > only works on the parent item but not on single occurrences. Previously this > was no problem because the alarms were just stored based on the id. > > With the patch taking the recurrence id into account onDeleteItem() will fail > to remove the alarm timeout if you remove or modify a repeating event. Yes, and my proposed patch will fail, too. IMO another potential dataloss is caused by the half implemented alarmServiceObserver in lightning/components/lightningAlarmMonitor.js. It does not listen/react on item modifications, cleaning up the alarm dialog: 1. create an item, set alarm and let it fire 2. modify the item, e.g. changing title => a second alarm will fire 3. dismiss the first alarm => dataloss Don't know if this has been notified, but expect you know the bug :)
Attached patch different approach (obsolete) — — Splinter Review
This is a different approach to be further tested.
Attachment #273228 - Attachment is obsolete: true
Attachment #273228 - Flags: review?(philipp)
Status: NEW → ASSIGNED
Attached patch fix — — Splinter Review
Attachment #273254 - Attachment is obsolete: true
Attachment #273401 - Flags: review?(philipp)
(In reply to comment #14) Filed follow-up bug 389245.
Comment on attachment 273401 [details] [diff] [review] fix > function calAlarmService() { > this.wrappedJSObject = this; > > this.mLoadedCalendars = {}; >+ this.mTimerLookup = {}; >+ this.mObservers = []; ... > > calAlarmService.prototype = { > mRangeEnd: null, >- mEvents: {}, >- mObservers: [], > mUpdateTimer: null, > mStarted: false, I like declaring all prototype variables here (mTimerLookup, etc). If you want feel free to do so. >+ addTimer: function cas_addTimer(aItem, aTimer) { Trailing whitespaces >+ if (!itemTimers) { >+ itemTimers = cal[aItem.id] = { mCount: 0 }; >+ } Please put this in multiple statements. r=philipp with the above fixed.
Attachment #273401 - Flags: review?(philipp) → review+
Checked in on HEAD and MOZILLA_1_8_BRANCH.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
OS: Windows XP → All
Hardware: PC → All
Resolution: --- → FIXED
Target Milestone: --- → 0.7
We need a Litmus testcase/testcases for alarms + repeating events.
Flags: in-litmus?
Flags: in-litmus?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: