Closed Bug 834343 Opened 11 years ago Closed 1 year ago

nsIdleService reports active topic even when there is no activity

Categories

(Core :: Widget, defect, P3)

x86_64
Windows
defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: alien0101, Assigned: florian)

References

(Blocks 1 open bug)

Details

(Whiteboard: [Power:P3], tpi:+)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17

Steps to reproduce:

I am using nsIdleService to detect idle time.


Actual results:

As soon as user is inactive for specific period nsIdleService triggers and reports idletime.
But even is there is no keyboard or mouse event but if there is some desktop notification like Outlook meeting reminder or gmail notifier nsIdleservice reports active topic.
Is this by design?


Expected results:

nsIdleService should not report active topic unless there is any keyboard or mouse event.

Please suggest how to use nsIdleservice in proper manner.
Whiteboard: [Power]
According to MDN[1] and StackOverflow[2], GetLastInputInfo which we use to implement idle service on Windows could be confused by synthesized input events or faulty drivers. I'm not sure if there is better way to detect that.

[1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646302%28v=vs.85%29.aspx
[2]: http://stackoverflow.com/questions/26327150/getlastinputinfo-does-not-correctly-work
Whiteboard: [Power] → [Power:P3]
Priority: -- → P3
Whiteboard: [Power:P3] → [Power:P3], tpi:+
Severity: normal → S3

Hi Florian, do you know if that this issue is still present or if APIs have been changed so that we could better detect those situations? I wonder how much it could affect the power performance.

Flags: needinfo?(florian)

(In reply to Henrik Skupin (:whimboo) [⌚️UTC+1] from comment #2)

Hi Florian, do you know if that this issue is still present or if APIs have been changed so that we could better detect those situations?

I don't know about this specific situation of desktop notifications resetting the idle time, but we have an issue that definitely exists where interacting with any other application resets the idle time in Firefox.

I wonder how much it could affect the power performance.

I just put for review a patch in bug 1768920 that should change the behavior to improve power performance of the user idle service. If the patch goes through, this bug should no longer exist, as we will only send a "back" notification if Firefox receives user events.

Depends on: 1768920
Flags: needinfo?(florian)
Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED

Actually, looking at a long profile of Firefox sitting there doing nothing, we reset the idle service about once per hour, when receiving a WM_MOUSEMOVE message from Windows: https://share.firefox.dev/3kxptEd

Interestingly, the mouse moves are all for the same position on the screen, and our event handling code has a test to avoid triggering a DOM event in that case, but still calls UserActivity(): https://searchfox.org/mozilla-central/rev/3ede9deb876ad5d6389cb51b371d4a4c8d788deb/widget/windows/nsWindow.cpp#4428,4440-4443

Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: FIXED → ---
Assignee: nobody → florian
Blocks: power-usage
No longer blocks: power
Status: REOPENED → ASSIGNED
OS: Windows 7 → Windows
Pushed by fqueze@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4751a60ba983
[Windows] reset the idle time of the user idle service for mouse move events only if the mouse moved by at least 1 pixel, r=cmartin.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch

I profiled a nightly with the fix last night: https://share.firefox.dev/3KK5NHY
It didn't receive a hourly WM_MOUSEMOVE message as I saw in the profile in comment 4, but there was still one WM_MOUSEMOVE message during the night, and the profile confirms it didn't reset the user idle time.

Duplicate of this bug: 973591
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: