Issue metadata
Sign in to add a comment
|
iFrame PostMessage being throttled on background tabs
Reported by
carinael...@gmail.com,
Jan 25 2017
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 Steps to reproduce the problem: http://iframetesthost.azurewebsites.net/ 1. Add an iframe in a web page 2. post message to iframe when visibilityState: visible. Message receive delay is 0 3. Switch to background tab. Post message when visibilityState: hidden 4. Message receive delay is a second. You can observe results of tabbing in/out in the developer tools console What is the expected behavior? There should be no delay in receiving postmessage evt data when visibilityState: hidden What went wrong? Iframe postMessage delay in background tabs Did this work before? Yes 54 Chrome version: 55.0.2883.87 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 24.0 r0
,
Jan 25 2017
Tested this issue on Windows-10 using chrome latest stable M55-55.0.2883.87 by following steps mentioned in the original comment, Observed there is a delay in receiving postmessage evt data under console. Tested the same issue on M54 54.0.2786.0 & 54.0.2832.0 and observed the same behavior over there. Unable to receive the Iframe postMessage in a second or more than 5 seconds. carinaelena@ Attaching the screen-shot for reference, Could you please let us know what's the actual behavior seen on M54? Any idea exactly on which version it used to work? Thanks!
,
Jan 25 2017
See issue 616519 . Chrome aligns timers of backgrounded tabs to 1Hz (i.e. 1 event per second). In Chrome 57 throttling starts 10 second after backgrounding the page (in Chrome 55 throttling started immediately after backgrounding). You can disable this behavior (see issue 485425) by running chrome --disable-background-timer-throttling
,
Jan 25 2017
This isn't an issue regarding throttling of timers, rather postMessage seems to be throttled as well... I attached an image of what I am seeing in Chrome 55. Chrome 54 behavioor aligns with the screenshot attached by @brajkumar
,
Jan 25 2017
BTW...deltas shown are in milliseconds
,
Jan 25 2017
Maybe it's the result of issue 487937 "Throttle the entire rendering pipeline for out-of-view cross origin frames"
,
Jan 25 2017
In this case, the frames are in view
,
Jan 26 2017
Added a show/hide link to take the iframe off-screen to show that this is not the case.
,
Jan 26 2017
haraken@ did we move the post message tasks to the timer queue?
,
Jan 26 2017
,
Jan 26 2017
For worker->document postMessage, TaskType::PostedMessage[1] is used. This task is queued into TimerTaskRunner[2]. [1] https://chromium.googlesource.com/chromium/src/+/06f260832ead33668b4fa5a64074fb8a158b127f/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp#70 [2] https://chromium.googlesource.com/chromium/src/+/1174657e747a79abfc910fdd863552562ccfc8da/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp#28 For document<->frame postMessage, Timer class is used[3] and its task is also queued into TimerTaskRunner[4]. [3] https://chromium.googlesource.com/chromium/src/+/a980b812f2f213270551f986fc7c4fdf0cc2d3a8/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp#621 [4] https://chromium.googlesource.com/chromium/src/+/4dbdb0dd364c7ac324c731004d1ccc69e3bdf2e2/third_party/WebKit/Source/platform/Timer.cpp#141
,
Jan 26 2017
Sami, Altimin: What should we do here? Maybe should we map TaskType::PostMessage to an unthrottled task runner? Or should we push altimin's timer-task-queue-split forward?
,
Jan 27 2017
I think that we need to revise task mapping and map TaskType::PostMessage (and maybe others) to unthrottled task runner as an immediate measure (M56?). Timer-task-queue-split will happen no earlier than M58.
,
Jan 27 2017
Yeah, the best short term fix is probably to move both types of postMessages to an unthrottled task runner. nhiroki@, can you help with this part? Longer term we should consider throttling these tasks again either with an opt-out or a way to detect that the tab is doing meaningful work in the background (e.g., it has a real time network connection). In parallel we'll also improve our CPU time instrumentation which should help establish how urgent it is to throttle these types of tasks.
,
Jan 30 2017
How about other TaskTypes that can be used for background operations, for example, TaskType::WebSocket and TaskType::DatabaseAccess? Do we move them to the unthrottle task runner, too?
,
Jan 30 2017
Assuming the motivation of the timer throttling is to reduce unneeded polling or GUI refresh on a background tab. So, IMO, we can map a TaskType to non-timer task runner if the task type is not related to GUI and its throttling expected not to reduce the total amount of CPU time. Namely, RemoteEvent, Microtask, WebSocket, PostedMessage, FileReading, and DatabaseAccess? To be discussed.
,
Jan 31 2017
I'm not sure GUI-relatedness is a good discriminator: if the work being done isn't observable by the user, why should we let it run? Android and iOS are very strict about limiting what backgrounded activities can do, and we may need to be similarly strict to actually reduce power usage.
,
Jan 31 2017
Just in case, I'm talking about the immediate measure on c#13. For longer term, throttling task types other than realtime communication and audio sounds reasonable to me. I'm a bit confused about why we move only postMessage to the unthrottled task runner as the immediate measure here. Why don't we move others? Is only postMessage being accidentally throttled? (Note that other tasks like WebSocket and DatabaseAccess are also posted to the timer task runner)
,
Feb 2 2017
,
Feb 5 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/04055dd2786e27cde8d210b68e7a726fab6d0c42 commit 04055dd2786e27cde8d210b68e7a726fab6d0c42 Author: nhiroki <nhiroki@chromium.org> Date: Sun Feb 05 04:05:05 2017 Scheduler: Enqueue non-JS-timer tasks into the unthrottled task runner We found throttling some of non-JS-timer tasks may break existing web pages, so this CL tentatively makes them unthrottled. In addition, this CL switches a task type for PostMessageTimer from TaskType::Timer to TaskType::PostedMessage because the timer is used only for performing postMessage() and actually not used as a JS timer. BUG= 684947 Review-Url: https://codereview.chromium.org/2669883003 Cr-Commit-Position: refs/heads/master@{#448173} [modify] https://crrev.com/04055dd2786e27cde8d210b68e7a726fab6d0c42/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp [modify] https://crrev.com/04055dd2786e27cde8d210b68e7a726fab6d0c42/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
,
Feb 7 2017
My fix was landed in... $ git find-releases 04055dd2786e27cde8d210b68e7a726fab6d0c42 commit 04055dd2786e27cde8d210b68e7a726fab6d0c42 was: initially in 58.0.3004.0
,
Feb 7 2017
,
Feb 7 2017
Your change meets the bar and is auto-approved for M57. Please go ahead and merge the CL to branch 2987 manually. Please contact milestone owner if you have questions. Owners: amineer@(clank), cmasso@(bling), ketakid@(cros), govind@(desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Feb 7 2017
,
Feb 7 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/91f69c5c73122c96f0690490d09b176526bf975b commit 91f69c5c73122c96f0690490d09b176526bf975b Author: Hiroki Nakagawa <nhiroki@chromium.org> Date: Tue Feb 07 11:04:22 2017 [Merge to M57] Scheduler: Enqueue non-JS-timer tasks into the unthrottled task runner We found throttling some of non-JS-timer tasks may break existing web pages, so this CL tentatively makes them unthrottled. In addition, this CL switches a task type for PostMessageTimer from TaskType::Timer to TaskType::PostedMessage because the timer is used only for performing postMessage() and actually not used as a JS timer. BUG= 684947 Review-Url: https://codereview.chromium.org/2669883003 Cr-Commit-Position: refs/heads/master@{#448173} (cherry picked from commit 04055dd2786e27cde8d210b68e7a726fab6d0c42) Review-Url: https://codereview.chromium.org/2679083002 . Cr-Commit-Position: refs/branch-heads/2987@{#359} Cr-Branched-From: ad51088c0e8776e8dcd963dbe752c4035ba6dab6-refs/heads/master@{#444943} [modify] https://crrev.com/91f69c5c73122c96f0690490d09b176526bf975b/third_party/WebKit/Source/core/dom/TaskRunnerHelper.cpp [modify] https://crrev.com/91f69c5c73122c96f0690490d09b176526bf975b/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
,
Feb 8 2017
This is too late for M56, which has already launched to Stable, the user impact and that this is a long standing issue doesn't justify doing an emergency merge. Let's wait until M57 |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by nyerramilli@chromium.org
, Jan 25 2017