MainThreadOnly::delayed_incoming_queue keeps growing in size by keeping Facebook open |
||||||
Issue descriptionI had Facebook open for a day and the incoming task queue keeps growing. It was initially 0 and after a day it is 2.5MiB in size. I think it has 2600 tasks. But I am not sure. Is this possibly a leak or is Facebook website responsible for the tasks? Attached a memory-infra trace file after a day.
,
Jan 13 2017
Sorry, I just verified the size of each Task object. It looks like 30,000 tasks are in the queue. (2.5MB / 80 bytes)
,
Jan 13 2017
Interesting. Some pages do post tasks faster than they processed and the tasks just pile up. If we're lucky a significant proportion these tasks might have been cancelled in which case we could consider sweeping them away periodically. If not we probably need to reach out to facebook and explain the problem.
,
Jan 13 2017
I think Alex has a patch for this in progress.
,
Jan 13 2017
Yes I have a patch in the works to periodically sweep canceled delayed tasks. Some usage patterns for DOM timers can really cause them to pile up (basically repeatedly posting and canceling a setTimeout with a long delay). Of course if the page is posting tasks father than they can be consumed there's not much we can do about that.
,
Jan 13 2017
*faster than they can be consumed.
,
Jan 14 2017
I think it cannot be the case where Facebook is creating tasks at such a rate where it gets accumulated over a day to 30000, when it's idle. It will mean that whole day it has been doing tasks, consuming cpu all day. Also I found that it was using similar memory in another trace I took few hours earlier. Attaching stack trace in case it's useful.
,
Jan 14 2017
Can you take a trace with disabled-by-default-renderer.scheduelr.dbg? That will let us know if the tasks are cancelled or not.
,
Jan 16 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5 commit fd870526d2ed5a6b3577b46aa9f01532b15bc6d5 Author: alexclarke <alexclarke@chromium.org> Date: Mon Jan 16 12:47:00 2017 Add an idle task to periodically sweep canceled delayed tasks It turns out canceled delayed tasks can really pile up for some pages where they repeatedly post dom timers with long delays and cancel them. This patch adds an idle task which every 30s sweeps away all canceled delayed tasks. We also add the concept of PostDelayedIdleTask to do so. PostDelayedIdleTask posts a task which is eligible to run after the next time an idle period starts. I.e. this has after wakeup semantics, i.e. unless something else wakes the CPU up, it won't run. BUG= 680815 Review-Url: https://codereview.chromium.org/2637463002 Cr-Commit-Position: refs/heads/master@{#443877} [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/BUILD.gn [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager_unittest.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc [add] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.cc [add] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper.h [add] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_canceled_delayed_task_sweeper_unittest.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_helper.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_helper.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/single_thread_idle_task_runner.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/public/platform/scheduler/child/compositor_worker_scheduler.h [modify] https://crrev.com/fd870526d2ed5a6b3577b46aa9f01532b15bc6d5/third_party/WebKit/public/platform/scheduler/child/single_thread_idle_task_runner.h
,
Jan 23 2017
,
Jan 23 2017
Holy cow, we're shipping M56 to stable this week for desktop and next week for Android, there is *no way* we can take a patch of the size of the one in c#9 right now. How bad is this regression, which is currently marked as a Pri-2? What platforms does it impact? If this has really high impact and we can't get a more simplified patch we're going to have to make some really hard decisions by tomorrow morning.
,
Jan 23 2017
Please see Issue 676082 for the original genesis of this bug. The bottom line is there's a large memory leak somewhere but no one has confirmed the true cause or knows the full scope of affected users.
,
Jan 23 2017
The memory issues fixed by https://codereview.chromium.org/2637463002 where introduced by the blink scheduler launch well over a year ago. I don't see why this should block M56.
,
Jan 23 2017
Incidentally please don't take that to mean I think memory concerns are trivial. I sit opposite the memory infra folks and I support what they're doing :) Just M56 is almost here and I doubt 6 waiting an extra 6 weeks will hurt since it's been broken for ages.
,
Jan 23 2017
Yeah, I'm going to remove RB-Stable given that. Can we please get an accurate OS tagging please? Issue 676082 is Linux, Mac - is that really all that's impacted here?
,
Jan 26 2017
This no longer appears in my testing. Thanks! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by vadimsh@chromium.org
, Jan 13 2017