Closed
Bug 1407069
Opened 7 years ago
Closed 7 years ago
Playing A YouTube Video With WebRender Enabled And Leaving It Alone Causes Shared Memory To Continuously Rise
Categories
(Core :: Graphics: WebRender, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla58
Tracking | Status | |
---|---|---|
firefox57 | --- | unaffected |
firefox58 | --- | unaffected |
People
(Reporter: kah0922, Assigned: nical)
References
Details
(Whiteboard: [wr-mvp])
Attachments
(2 files, 3 obsolete files)
777 bytes,
patch
|
nical
:
review+
|
Details | Diff | Splinter Review |
4.86 KB,
patch
|
sotaro
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0
Build ID: 20171009100134
Steps to reproduce:
This is on openSUSE Tumbleweed with a Radeon RX460.
Enable WebRender and GPU Process.
Play a YouTube video.
Disable subtitles (and possibly annotations as well)
While the video is playing, do not interact with the video window in any way.
Actual results:
Shared Memory usage of the Web Process and the GPU process will climb continuously until the computer runs out of memory.
Strangely, the Shared Memory resets itself to normal if you interact with the YouTube video by either hovering over it with your mouse or enabling subtitles.
Expected results:
Shared Memory should not reach 4GBs and crash the web browser.
Reporter | ||
Updated•7 years ago
|
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Updated•7 years ago
|
Whiteboard: [wr-mvp] [triage]
Updated•7 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P1
Whiteboard: [wr-mvp] [triage] → [wr-mvp]
Comment 2•7 years ago
|
||
It is a fallout from pre AsyncImagePipelineManager era. On current gecko, each video pipe line has each pipeline id and epoch. We need to use them. But WebRenderImageHost::UseTextureHost() still use WebRenderBridgeParent's pipeline id and epoch.
https://dxr.mozilla.org/mozilla-central/source/gfx/layers/wr/WebRenderImageHost.cpp#197
Comment 3•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #2)
> It is a fallout from pre AsyncImagePipelineManager era. On current gecko,
> each video pipe line has each pipeline id and epoch. We need to use them.
> But WebRenderImageHost::UseTextureHost() still use WebRenderBridgeParent's
> pipeline id and epoch.
>
> https://dxr.mozilla.org/mozilla-central/source/gfx/layers/wr/
> WebRenderImageHost.cpp#197
It is a fallout, but it accidentally minimize the memory leak.
Actual source of memory leak is injected by Bug 1383786. It minimize updating DisplayList. The updating DisplayList updates also epoch. AsyncImagePipelineManager uses the epoch to recognize end of usage of WebRenderTextureHost by WebRender.
Updated•7 years ago
|
Comment 4•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #3)
>
> Actual source of memory leak is injected by Bug 1383786. It minimize
> updating DisplayList. The updating DisplayList updates also epoch.
> AsyncImagePipelineManager uses the epoch to recognize end of usage of
> WebRenderTextureHost by WebRender.
If there is a update of WebRenderTextureHost usage in resourceUpdates, we need to push DisplayList with current gecko and WebRender.
Comment 5•7 years ago
|
||
Bug 1383786 also removed a case that ImageHost does not have TextureHost for composite. We also need to handle this case.
Comment 6•7 years ago
|
||
Comment 7•7 years ago
|
||
Updated•7 years ago
|
Attachment #8917657 -
Attachment description: patch - Make ApplyAsyncImages() as to push display list if WebRenderTextureHosts usages are updated → patch part 1 - Make ApplyAsyncImages() as to push display list if WebRenderTextureHosts usages are updated
Updated•7 years ago
|
Attachment #8917658 -
Attachment description: patch - Do not hold external image in WebRenderImageHost::SetCurrentTextureHost() if ImageHost is async → patch part 2 - Do not hold external image in WebRenderImageHost::SetCurrentTextureHost() if ImageHost is async
Comment 8•7 years ago
|
||
Comment 9•7 years ago
|
||
R4 failed because of TEST-UNEXPECTED-PASS.
REFTEST TEST-UNEXPECTED-PASS | file:///builds/worker/workspace/build/tests/reftest/tests/layout/reftests/bugs/579323-1.html == file:///builds/worker/workspace/build/tests/reftest/tests/layout/reftests/bugs/579323-1-ref.html | image comparison, max difference: 0,
Comment 10•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #9)
> R4 failed because of TEST-UNEXPECTED-PASS.
>
> REFTEST TEST-UNEXPECTED-PASS |
> file:///builds/worker/workspace/build/tests/reftest/tests/layout/reftests/
> bugs/579323-1.html ==
> file:///builds/worker/workspace/build/tests/reftest/tests/layout/reftests/
> bugs/579323-1-ref.html | image comparison, max difference: 0,
The test was set failed by Bug 1403457 because of regression of bug 1383786.
Comment 11•7 years ago
|
||
Comment 12•7 years ago
|
||
Updated•7 years ago
|
Attachment #8917657 -
Flags: review?(nical.bugzilla)
Updated•7 years ago
|
Attachment #8917658 -
Flags: review?(nical.bugzilla)
Updated•7 years ago
|
Attachment #8917738 -
Flags: review?(nical.bugzilla)
Assignee | ||
Comment 13•7 years ago
|
||
Comment on attachment 8917657 [details] [diff] [review]
patch part 1 - Make ApplyAsyncImages() as to push display list if WebRenderTextureHosts usages are updated
Review of attachment 8917657 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry, this looks like a step in the wrong direction. If there is a bug in the way we manage the lifetime of external images, let's figure it out and fix it, but it is important to not rebuild scenes when we don't need to, especially during video playback.
Comment 14•7 years ago
|
||
I created the patch to fix the problem soon. We could address the lifetime of external images in a different bug.
Assignee | ||
Comment 15•7 years ago
|
||
I understand. I don't think we need to hurry about fixing this to the point of undoing something that we want. Let's use this bug to look for a long term solution (but we should definitely fix this soon-ish even if it takes a week or two).
Comment 16•7 years ago
|
||
(In reply to Keith Hizal from comment #0)
> Linux x86_64; rv:58.0
> This is on openSUSE Tumbleweed with a Radeon RX460.
> Enable WebRender and GPU Process.
I have Nightly 58 x64 @ Debian Testing (KDE, Radeon RX480(!), same prefs) and saw similar, but not a problem with "shared memory", rather "memory"(attachment 8914537 [details]): I think(!) blob-images was the cause: bug 1405168. Since I disabled it I haven't had such a memory problem so far. I may be totally wrong and don't know what I'm talking about. (Unrelated: bug 1402067)
Assignee | ||
Comment 17•7 years ago
|
||
I filed https://github.com/servo/webrender/issues/1870 to address the missing webrender bits.
Comment 18•7 years ago
|
||
I created Bug 1408348 just to address lifetime handling of WebRenderTextureHost, I am not sure yet https://github.com/servo/webrender/issues/1870 could help well to the lifetime handling.
Updated•7 years ago
|
Attachment #8917657 -
Flags: review?(nical.bugzilla)
Updated•7 years ago
|
Attachment #8917658 -
Flags: review?(nical.bugzilla)
Updated•7 years ago
|
Attachment #8917738 -
Flags: review?(nical.bugzilla)
Reporter | ||
Comment 19•7 years ago
|
||
(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #16)
> I have Nightly 58 x64 @ Debian Testing (KDE, Radeon RX480(!), same prefs)
> and saw similar, but not a problem with "shared memory", rather
> "memory"(attachment 8914537 [details]): I think(!) blob-images was the
> cause: bug 1405168. Since I disabled it I haven't had such a memory problem
> so far. I may be totally wrong and don't know what I'm talking about.
> (Unrelated: bug 1402067)
I disabled blob images and still encountered the same problem as before.
Assignee | ||
Comment 20•7 years ago
|
||
UpdatePipelineResources was temporarily added to webrender's API to address this use case (bumping the epoch when resources are updated with no new display list).
In the longer run we'll refactor webrender's API to more flexibly compose transactions and the new UpdatePipelineResources message will be removed, but in the mean time we can address this bug.
Attachment #8920101 -
Flags: review?(sotaro.ikeda.g)
Assignee | ||
Comment 21•7 years ago
|
||
> I created Bug 1408348 just to address lifetime handling of WebRenderTextureHost, I am not sure yet https://github.com/servo/webrender/issues/1870 could help well to the lifetime handling.
Oops I missed that, the patch I just posted may not be up to date with your latest work, I'll have a look.
Assignee | ||
Comment 22•7 years ago
|
||
Updated patch. I had forgotten to call HoldExternalImage when not going through the set_display_list path.
With this patch I have been able to confirm that all epochs are correctly reported back when updating images using the UpdatePipelineResources api.
However, the number of live TextureHosts is still growing to worryingly high levels (~600 just watching a video). It appears that the vast majority most of the deallocations are happening when the TextureParent is destroyed, which would indicate that a lot of the textures are held alive on the content side.
Looks like there is more to this issue than the compositor-side lifetime management.
Attachment #8920101 -
Attachment is obsolete: true
Attachment #8920101 -
Flags: review?(sotaro.ikeda.g)
Attachment #8920125 -
Flags: review?(sotaro.ikeda.g)
Assignee | ||
Comment 23•7 years ago
|
||
Comment on attachment 8920125 [details] [diff] [review]
Associate epochs to frames with image updates
Review of attachment 8920125 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/layers/wr/AsyncImagePipelineManager.cpp
@@ +272,5 @@
> // We don't need to update the display list, either because we can't or because
> // the previous one is still up to date.
> // We may, however, have updated some resources.
> + mApi->UpdatePipelineResources(resourceUpdates, pipelineId, epoch);
> + if (mCurrentTexture) {
Sorry there's a mistake here (should be pipeline->mCurrentTexture), it's fixed locally.
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1883
Updated•7 years ago
|
Attachment #8917657 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #8917658 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #8917738 -
Attachment is obsolete: true
Updated•7 years ago
|
Attachment #8917658 -
Attachment is obsolete: false
Comment 24•7 years ago
|
||
(In reply to Nicolas Silva [:nical] from comment #22)
> Created attachment 8920125 [details] [diff] [review]
> Associate epochs to frames with image updates
>
> Updated patch. I had forgotten to call HoldExternalImage when not going
> through the set_display_list path.
>
> With this patch I have been able to confirm that all epochs are correctly
> reported back when updating images using the UpdatePipelineResources api.
> However, the number of live TextureHosts is still growing to worryingly high
> levels (~600 just watching a video). It appears that the vast majority most
> of the deallocations are happening when the TextureParent is destroyed,
> which would indicate that a lot of the textures are held alive on the
> content side.
:nical, Isn't the problem be fixed with attachment 8917658 [details] [diff] [review]?
Comment 25•7 years ago
|
||
Comment on attachment 8920125 [details] [diff] [review]
Associate epochs to frames with image updates
Review of attachment 8920125 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good. Thanks!
Attachment #8920125 -
Flags: review?(sotaro.ikeda.g) → review+
Comment 26•7 years ago
|
||
Assigned to nical, since he created the patch.
Assignee: sotaro.ikeda.g → nical.bugzilla
Assignee | ||
Comment 27•7 years ago
|
||
> :nical, Isn't the problem be fixed with attachment 8917658 [details] [diff] [review] [diff] [review]?
Marvelous! it does fix the problem indeed \o/
Assignee | ||
Updated•7 years ago
|
Attachment #8917658 -
Flags: review+
Comment 28•7 years ago
|
||
Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/73adbbe06358
Associate epochs to async image updates. r=sotaro
https://hg.mozilla.org/integration/mozilla-inbound/rev/647efba379ee
Do not hold external image in SetCurrentTextureHost if ImageHost is async. r=nical
Comment 29•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/73adbbe06358
https://hg.mozilla.org/mozilla-central/rev/647efba379ee
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in
before you can comment on or make changes to this bug.
Description
•