New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 627539 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Android MediaRouter only (left Chro...
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocked on:
issue 628367



Sign in to add a comment

WebKit Linux Leak (webkit_tests) failure on 9d961d0a083fe4ebd8c200c31b87d75e4727958b

Project Member Reported by dbeam@chromium.org, Jul 12 2016

Issue description

According to https://www.chromium.org/blink/sheriffing, I should update LeakExpectations

After that, I'll re-assign to zqzhang@.

/cc hajimehoshi@ and kouhei@ as they're mentioned in LeakExpectations

My guess is that we're not calling removeEventListener() if a media element isn't played, which causes the leak.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4a8c92c522776d84bfeff56855205fbb5771b785

commit 4a8c92c522776d84bfeff56855205fbb5771b785
Author: dbeam <dbeam@chromium.org>
Date: Tue Jul 12 21:30:56 2016

Revert "Measure whether muted videos that started playing with play() become visible at some point"

This reverts commit 9d961d0a083fe4ebd8c200c31b87d75e4727958b.

Seems to be leaking, broke WebKit Leak bots here:
https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Linux%20Leak/builds/20963

BUG= 627539 , 622720 

TBR=zqzhang@chromium.org
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true

Review-Url: https://codereview.chromium.org/2141093003
Cr-Commit-Position: refs/heads/master@{#404836}

[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/third_party/WebKit/LayoutTests/media/video-autoplay-experiment-modes-expected.txt
[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/third_party/WebKit/Source/core/core.gypi
[delete] https://crrev.com/e2276c4abe46c25480470c3f6d6b968671a8a4df/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
[delete] https://crrev.com/e2276c4abe46c25480470c3f6d6b968671a8a4df/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/third_party/WebKit/Source/core/html/HTMLMediaElement.h
[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/third_party/WebKit/Source/core/html/OWNERS
[modify] https://crrev.com/4a8c92c522776d84bfeff56855205fbb5771b785/tools/metrics/histograms/histograms.xml

Comment 2 by dbeam@chromium.org, Jul 13 2016

Cc: -zqzh...@chromium.org
Owner: zqzh...@chromium.org
Cc: -kouhei@chromium.org -hajimehoshi@chromium.org haraken@chromium.org mlamouri@chromium.org
Status: Assigned (was: Unconfirmed)
Hi haraken, can you help me find the leak cause?

So basically HTMLMediaElement has Member<ElementVisibilityObserver>, and ElementVisibilityObserver has Member<Element> referencing the element. I think there is a reference cycle, but they are not garbage-collected.

Do you have any idea?

If I use WeakMember<Element>, the leak is gone. (https://codereview.chromium.org/2144073002/)
Cc: szager@chromium.org
+szager to take a look

Comment 5 by szager@chromium.org, Jul 14 2016

I uploaded a different CL that might be preferable to adding WeakMember:

https://codereview.chromium.org/2146383002

Comment 6 by szager@chromium.org, Jul 14 2016

Blockedon: 628367
Cc: zqzh...@chromium.org
 Issue 629044  has been merged into this issue.
Project Member

Comment 9 by bugdroid1@chromium.org, Jul 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/df5e915f2075aa324e59087cfca9848b6ff3f58a

commit df5e915f2075aa324e59087cfca9848b6ff3f58a
Author: zqzhang <zqzhang@chromium.org>
Date: Mon Jul 18 15:20:31 2016

Using wrapWeakPersistent for VisibilityCallback in HTMLMediaElement

This is a test patch that fixes a memory leak caused by the reference between
HTMLMediaElement and ElementVisibilityObserver.

The previous patch breaks the reference cycle but seems doesn't fix the leak.
Using WeakPersistent is a workaround, but seems does not fix the leak entirely.
Keeping  https://crbug.com/627539  open to keep track of the remaining leaks.

BUG= 628367 , 627539 

Review-Url: https://codereview.chromium.org/2151243002
Cr-Commit-Position: refs/heads/master@{#405996}

[modify] https://crrev.com/df5e915f2075aa324e59087cfca9848b6ff3f58a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Project Member

Comment 10 by bugdroid1@chromium.org, Jul 25 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/baf0ff22e47eb51e6cd4b0764d771151f7e0500b

commit baf0ff22e47eb51e6cd4b0764d771151f7e0500b
Author: sigbjornf <sigbjornf@opera.com>
Date: Mon Jul 25 11:45:02 2016

Simplify ElementVisibilityObserver implementation.

Recast ElementVisibilityObserver's VisibilityCallback in a more
Blink-like manner by way of a Client interface. Thereby also addressing
on-off-heap cycle, a leak source.

Similarly, simplify the connection between ElementVisibilityObserver and
IntersectionObserver -- have the former directly implement the
IntersectionObserverCallback instead of indirectly using closure callbacks.

R=
BUG= 627539 

Review-Url: https://codereview.chromium.org/2173353002
Cr-Commit-Position: refs/heads/master@{#407450}

[modify] https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.cpp
[modify] https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b/third_party/WebKit/Source/core/dom/ElementVisibilityObserver.h
[modify] https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b/third_party/WebKit/Source/core/dom/IntersectionObserver.h
[modify] https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
[modify] https://crrev.com/baf0ff22e47eb51e6cd4b0764d771151f7e0500b/third_party/WebKit/Source/core/html/HTMLMediaElement.h

Labels: Needs-BlinkMediaTriage
Project Member

Comment 13 by bugdroid1@chromium.org, Aug 16 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/339881fcea518c6f7ff6e1a04a2a5f40e26de850

commit 339881fcea518c6f7ff6e1a04a2a5f40e26de850
Author: zqzhang <zqzhang@chromium.org>
Date: Tue Aug 16 10:56:54 2016

Adding test to avoid memory leak when autoplayed video never become visible

BUG= 627539 

Review-Url: https://codereview.chromium.org/2251463002
Cr-Commit-Position: refs/heads/master@{#412210}

[add] https://crrev.com/339881fcea518c6f7ff6e1a04a2a5f40e26de850/third_party/WebKit/LayoutTests/media/autoplay-never-visible.html

zqzhang@, should this be fixed?
Status: Fixed (was: Assigned)
I think we can mark this as fixed for now.

The leak is very hard to trigger, and the tests does not catch it. Quoting my reply in the CL:

> The leak seems to be super hard to trigger now.
> 
> It only happens when I comment out `m_autoplayVisibilityObserver->stop()` in
> HTMLMediaElement, and run `autoplay-muted` tests.
> I narrowed down `autoplay-muted` tests and found that 3 of async_test/promise_test can trigger the leak when they are run at the same time,
> and one test that should have failed due to commenting `stop()` does not fail.
> 
> So my guess is that there exist some races among the async_tests/promise_tests
> that caused the leak. This might also explain why the leak is flaky.
Labels: -Needs-BlinkMediaTriage

Sign in to add a comment