Bug 810 - Workrave does not unsuspend itself after failed hibernation.
Status:
ASSIGNED
Component:
Core :: Win32
Version:
unspecified
Hardware:
PC Windows Vista
Importance:
P5 normal
Target Milestone:
---
Assignee:
Ray Satiro
URL:
Depends on:
Blocks:
Reported:
Jan 13 2009 05:57:54 UTC
by:
Ray Satiro
Modified:
Feb 22 2011 03:04:05 UTC
CC List:
Abhijit Mahabal
Joe Conley
cliff
Rob Caelers
WhoWhenWhatRemovedAdded
cliffFeb 1 2011 15:22:57 UTCcccliff
Joe ConleyFeb 16 2011 06:02:48 UTCccJoe Conley
Rob CaelersFeb 17 2011 00:07:36 UTCccRob Caelers
Abhijit MahabalFeb 22 2011 02:40:28 UTCccAbhijit Mahabal
Description
Ray Satiro  Jan 13 2009 05:57:54 UTC
In some cases Windows will try to hibernate or sleep but is stopped by a driver or a program. This can cause a PBT_APMSUSPEND message immediately followed by PBT_APMRESUMEAUTOMATIC. Workrave thinks the computer is going to hibernate even though it is not. In this situation Workrave will suspend its timers and will not resume its previous state. There is no SUSPENDFAILED message sent by Windows, but if there was this bug would still occur.

MSDN notes this:
"If the system detects any user activity after broadcasting PBT_APMRESUMEAUTOMATIC, it will broadcast a PBT_APMRESUMESUSPEND event to let applications know they can resume full interaction with the user."

I don't find that to be true. Observed on Vista:

02:06:09 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:06:09 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:06:09 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:06:43 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:06:43 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:06:44 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:07:16 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:07:16 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:07:17 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:08:04 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:08:04 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:08:05 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:09:28 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:09:28 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:09:28 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:09:42 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:09:42 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:09:42 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC
02:10:27 PM:	WM_POWERBROADCAST: PBT_APMSUSPEND
02:10:27 PM:	Core::set_operation_mode(): OPERATION_MODE_SUSPENDED 
02:10:27 PM:	WM_POWERBROADCAST: PBT_APMRESUMEAUTOMATIC


Windows apparently does not signal there is activity by sending a proper resume. Therefore I think we must rely on Workrave's activity monitors to make such a determination. I'm thinking a solution could be to handle APMRESUMEAUTOMATIC in GUI::win32_filter_func(), and possibly changes will be needed in Core::set_powersave().


Currently unsuspending Workrave in this situation requires manual intervention, 
e.g. Mode > Normal
Comment 1
cliff  Feb 1 2011 15:22:57 UTC
In Windows 7, this doesn't seem to be limited to just failures.  When I restart from successfully hibernating my machine, the application is still suspended.
Comment 2
Joe Conley  Feb 16 2011 06:02:48 UTC
(In reply to comment #1)
> In Windows 7, this doesn't seem to be limited to just failures.  When I restart
> from successfully hibernating my machine, the application is still suspended.

I am having this problem also.  It happened when I switched to Windows 7.  If I just tell the machine to sleep and come back in the morning, it is still in suspended mode, so I forget to re-enable it for half the day.

The best workaround for now for me is to make it visible in the windows taskbar so I might see the red line through the icon.

But it is unfortunate since I really rely on this program.  Thanks for the work you guys do.
Comment 3
Rob Caelers  Feb 17 2011 00:07:36 UTC
I believe the latest snapshot fixes this problem. Could you please install:

http://snapshots.workrave.org/20110216/workrave-win32-v1_9_3-57-g6e2ec53b37-20110216-installer.exe 

and let us know if hibernate/standby now works properly. Thanks.
Comment 4
Joe Conley  Feb 17 2011 03:10:54 UTC
Thanks a lot for the quick response Rob, I appreciate it.

I just installed that version and put the computer to sleep and woke it back up, and it appears to have fixed the issue, workrave did not stay in suspended mode.

You mentioned "Hibernate" and "Standby" modes, but I'm using the Japanese version of Win 7, and it just says "スリープ" which is just a Japanese-ized version of "sleep", so I'm not sure if that indicates "Hibernate" or "Standby" or some third mode.

Why are there so many sleep modes in the first place I am tempted to ask, but that's not your issue.

Thanks for your help!  I'll let you know if it becomes a problem again in the future, but I think it should be fine.  

Thanks again for the good software :-)
Comment 5
Abhijit Mahabal  Feb 22 2011 02:40:28 UTC
I have this problem too, and glad that it has been fixed. For various reasons, I won't be able to install the snapshot on my work machine. When would this patch be part of a release (any dates for 1.9.4?)

Thanks,
  Abhijit
Comment 6
cliff  Feb 22 2011 03:04:05 UTC
(In reply to comment #3)
> I believe the latest snapshot fixes this problem. Could you please install:
> 
> http://snapshots.workrave.org/20110216/workrave-win32-v1_9_3-57-g6e2ec53b37-20110216-installer.exe 
> 
> and let us know if hibernate/standby now works properly. Thanks.

unfortunately, this doesn't seem to solve my problem.  Workrave doesn't restart after hibernation.   :(

Win 7 enterprise x64.