Web Extension alarms delayed if computer has been suspended after creation of alarm
Categories
(WebExtensions :: General, defect, P5)
Tracking
(Not tracked)
People
(Reporter: w0t.w0t.owl, Unassigned)
References
(Depends on 1 open bug)
Details
(Whiteboard: [alarms][triaged])
Attachments
(1 file)
2.84 KB,
application/x-xpinstall
|
Details |
Reporter | ||
Comment 1•8 years ago
|
||
Updated•8 years ago
|
Comment 4•7 years ago
|
||
Updated•7 years ago
|
Comment 6•7 years ago
|
||
Comment 7•6 years ago
|
||
A similar problem also affects Thunderbird, just replace "Web Extension alarms" with "mail checks".
The cause is the same - CLOCK_MONOTONIC is used internally for timers and time stamps in general.
As Rob has said in comment 3 while it is easy to make mozilla::TimeStamp family return CLOCK_BOOTTIME
there is a problem with pthreads condition variables that threads use for sleeping -
they don't support the CLOCK_BOOTTIME clock.
In fact, the problem lies deeper than pthreads library - the kernel futex() syscall only supports
CLOCK_MONOTONIC and CLOCK_REALTIME clocks.
I can see basically two solutions here:
-
Add CLOCK_BOOTTIME support to the kernel futex() syscall THEN use it to implement CLOCK_BOOTTIME
support for pthreads condition variables in glibc THEN switch mozilla::detail::ConditionVariableImpl
and mozilla::TimeStamp to this clock, OR: -
Rewrite mozilla::detail::ConditionVariableImpl and so using timerfds for Linux -
this will use about 2 extra fds per condition variable.
A serious error handling needs to be added to these classes in this case since the current implementation
just throws an assertion failure on any error.
This problem isn't limited to Mozilla software - pretty much everywhere CLOCK_MONOTONIC is currently used
the CLOCK_BOOTTIME behaviour is really expected.
That's why a year ago kernel people tried to rename CLOCK_MONOTONIC to CLOCK_MONOTONIC_ACTIVE while
aliasing CLOCK_MONOTONIC to CLOCK_BOOTTIME.
However, they had to back out of that change since it broke some (non-Mozilla) software.
Comment 8•6 years ago
|
||
I was directed to this thread after observing the same behavior on MacOS. Since it looks like the general consensus points to this being a Linux-only issue, I figured my observations may be of use. I tested on both MacOS and Windows, and found that the issue is only present on MacOS.
MacOS User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Firefox/68.0
Windows User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Here's a gist of my findings:
https://gist.github.com/dbuer/6946615935dc0799dbeea1071f067db7
Updated•3 years ago
|
Comment 9•3 months ago
|
||
The topic of alarm handling when the host system sleeps has come up in the WebExtensions Community Group in https://github.com/w3c/webextensions/issues/433.
Progress on that issue stalled due to a combination of two factors: within the group we were aligning on using wall clock time for alrms, but we also wanted to align with web behavior, which is currently not well defined. See also https://github.com/whatwg/html/issues/6759.
Description
•