After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 680611 - Hibernation shifts alarm notification time
Hibernation shifts alarm notification time
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Calendar
3.4.x (obsolete)
Other Linux
: Normal major
: ---
Assigned To: evolution-calendar-maintainers
Evolution QA team
: 692059 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-07-25 17:33 UTC by Stanislav Brabec
Modified: 2013-03-11 17:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
evo patch (2.78 KB, patch)
2012-09-12 08:10 UTC, Milan Crha
committed Details | Review

Description Stanislav Brabec 2012-07-25 17:33:42 UTC
How to reproduce:

1. Create an event to today from 15:00 to 16:00 using the Calendar application in the Android mobile phone, with appointment set 15 minutes before the event.

Actual behavior:
Appointment appeared in the mobile phone at 14:45 and on Evolution desktop at 18:47.

Expected behavior:
Appointment appeared on both devices at 14:45.

Additional information:

evolution-3.4.2 openSUSE 12.2 RC2 x86_64

Language: cz_CZ

Time zone: CEST (+2:00)

Looking at https://www.google.com/calendar/ I correctly see the event from 15:00 and the time zone correctly set to Prague (+1:00, but now DST is active).
Comment 1 Stanislav Brabec 2012-08-16 14:29:16 UTC
Using it a bit longer, it seems that delaying by 4 hours was just a random.

Some appointments are immediate (in the second when Android phone beeps), other are delayed by several hours, other appear 5 days later after the next login to the system.

Anyway, believing that appointments from Google Calendar will pop-up in Evolution in time is really naive. It makes Google Calendar in Evolution unusable.
Comment 2 Milan Crha 2012-09-05 16:34:10 UTC
Thanks for a bug report. I tried similar steps, only without Android phone. I created an event in google's web interface, and then I refreshed the local calendar, and I see the event on the same hour in both views (web UI and Evolution). I have also set Evolution to use system timezone, which is Europe/Prague, and the Google's calendar in Prague timezone.

I suppose, in your description, you meant Alarm, with the "Appointment appeared", did you? Do you see event at the correct time in Evolution's calendar or it's shifted there too?
Comment 3 Stanislav Brabec 2012-09-11 16:11:12 UTC
Looking at the calendar, I see the appointment in the correct time.

Yes, the appointment alarms are delayed. They seem not to be shifted, but just plainly delayed by random amount of time. Sometimes they often silently stop to appear, and appear a week later after re-login. It looks like the appointment daemon silently stops or crashes.

I restart/relogin my machine only several times a month. I hibernate overnight without quitting Evolution.

I did not do any manual refresh of the calendar.
Comment 4 Milan Crha 2012-09-11 16:39:47 UTC
Missing reminders are caused by evolution-alarm-notify process being down, I'm almost sure with that. The shift of reminders, hmm, that is harder. My wild shot would be the hibernation, the alarm notify process probably doesn't reschedule its events, which are all maintained by GLib itself. In other words, the evolution-alarm-notify process doesn't know about the time shift caused by the hibernation.

I would like to know opinion from GLib developers, because the events are just callbacks scheduled by g_timeout_add() and similar functions.
Comment 5 Matthew Barnes 2012-09-11 18:26:55 UTC
(In reply to comment #4)
> I would like to know opinion from GLib developers, because the events are just
> callbacks scheduled by g_timeout_add() and similar functions.

Scheduling calendar alarms based on monotonic CPU time is the wrong way.

If you schedule an alarm for one hour from now using g_timeout_add() and then hibernate, the alarm will fire after one hour of CPU time + however long the machine was hibernating.

libgnome-desktop has some API for scheduling main loop timeouts based on wall clock time instead of monotonic time, which is what we want.  But the API is not public for some reason.  We could perhaps copy and paste it into Evolution for now.

http://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-datetime-source.c
Comment 6 Milan Crha 2012-09-12 06:15:26 UTC
If I read it right, then the gnome-datetime-source checks once per second for expiration, which seems like an overhead. No that there are many alarms scheduled, there are about two, but anyway. The real improvement should go to GLib.
Comment 7 Milan Crha 2012-09-12 08:10:58 UTC
Created attachment 224073 [details] [review]
evo patch

for evolution;

This does basically the same as the above code, only in less lines and less frequently. There is done a check for the wall clock time once per minute, and if it differs from the expected time, then alarms are rescheduled. This may make up to one minute alarm delay.
Comment 8 Milan Crha 2012-09-12 08:12:25 UTC
Created commit 48d30dc in evo master (3.5.92+)
Comment 9 Matthew Barnes 2012-09-12 11:59:57 UTC
That works, waking up once per minutes makes more sense.

At some point we should start listening for UPower's "NotifyResume" signal so we can cut network connections, reschedule alarms, and deal with whatever other chaos suspend/hibernate causes on the internal process state.
Comment 10 Milan Crha 2012-09-12 16:58:39 UTC
I was thinking of UPower too, but then I got lazy. I also was thinking of GNetworkMonitor, which is listening for it too (through NetworkManager), but then I thought it would be overusing the network monitor for something not meant to be.
Comment 11 Milan Crha 2013-03-11 17:52:29 UTC
*** Bug 692059 has been marked as a duplicate of this bug. ***