Closed
Bug 1419255
Opened 7 years ago
Closed 7 years ago
Crash under WebRenderBridgeChild::~WebRenderBridgeChild()
Categories
(Core :: Graphics: WebRender, defect, P1)
Core
Graphics: WebRender
Tracking
()
RESOLVED
FIXED
mozilla59
People
(Reporter: sotaro, Assigned: nical)
References
Details
(Whiteboard: [wr-mvp])
Crash Data
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
sotaro
:
review+
|
Details | Diff | Splinter Review |
I saw the crash. It seems to be a regression of Bug 1411472.
https://crash-stats.mozilla.com/report/index/9a14b729-7add-4eee-97ab-8bb470171121
Reporter | ||
Comment 1•7 years ago
|
||
I do not have a specific STR, but it should to be related to video playback and canvas2d.
Reporter | ||
Updated•7 years ago
|
Assignee: nobody → sotaro.ikeda.g
Updated•7 years ago
|
Whiteboard: [wr-mvp] [triage]
Reporter | ||
Comment 2•7 years ago
|
||
Reporter | ||
Comment 3•7 years ago
|
||
attachment 8930344 [details] [diff] [review] borrows code from ShadowLayerForwarder::~ShadowLayerForwarder().
https://dxr.mozilla.org/mozilla-central/source/gfx/layers/ipc/ShadowLayers.cpp#221
Reporter | ||
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #0)
> I saw the crash. It seems to be a regression of Bug 1411472.
>
> https://crash-stats.mozilla.com/report/index/9a14b729-7add-4eee-97ab-8bb470171121
I think my [@ nsObserverService::RemoveObserver ] crashes in bug 1418201 look similar.
Reporter | ||
Comment 6•7 years ago
|
||
(In reply to Jan Andre Ikenmeyer [:darkspirit] from comment #5)
> (In reply to Sotaro Ikeda [:sotaro] from comment #0)
> > I saw the crash. It seems to be a regression of Bug 1411472.
> >
> > https://crash-stats.mozilla.com/report/index/9a14b729-7add-4eee-97ab-8bb470171121
>
> I think my [@ nsObserverService::RemoveObserver ] crashes in bug 1418201
> look similar.
Yes, it is same crash.
Reporter | ||
Updated•7 years ago
|
Attachment #8930344 -
Flags: review?(nical.bugzilla)
Assignee | ||
Comment 7•7 years ago
|
||
Why is a MediaFormatReader holding on to a WebRenderBridgeChild? This looks like a bug.
Updated•7 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [wr-mvp] [triage] → [wr-mvp]
Reporter | ||
Comment 8•7 years ago
|
||
(In reply to Nicolas Silva [:nical] from comment #7)
> Why is a MediaFormatReader holding on to a WebRenderBridgeChild? This looks
> like a bug.
MediaFormatReader holds WebRenderBridgeChild as layers::KnowsCompositor. The KnowsCompositor is used to know backend type since ImageBridge is not connected to specific Compositor. The KnowsCompositor is passed to PlatformDecoder and is used by the PlatformDecoder. One example is WMFVideoMFTManager::InitializeDXVA()
https://dxr.mozilla.org/mozilla-central/source/dom/media/platforms/wmf/WMFVideoMFTManager.cpp#523
Assignee | ||
Comment 9•7 years ago
|
||
Holding a WebRenderBridgeChild from multiple threads just to get access to a bit of constant information like the compositor backend is very dangerous for very little gains.
So I'm working on changing that by adding a atomic ref-counted object that contains the TextureFactoryIdentifier for the off-main-thread objects to hold on to. That way the WebRenderBridgeChild doesn't have to be held alive by any decoder but the decoders can get the bits information they need without causing a mess during shutdown.
Assignee | ||
Comment 10•7 years ago
|
||
Comment on attachment 8930344 [details] [diff] [review]
patch - Add non-MainThread case handling
Review of attachment 8930344 [details] [diff] [review]:
-----------------------------------------------------------------
Marking r- as I am working on an alternative solution that should remove the need to do this.
Attachment #8930344 -
Flags: review?(nical.bugzilla) → review-
Reporter | ||
Comment 11•7 years ago
|
||
Assign to :nical, since he is working for it as in Comment 10.
Assignee: sotaro.ikeda.g → nical.bugzilla
Assignee | ||
Comment 12•7 years ago
|
||
> I'm working on changing that by adding a atomic ref-counted object that contains the TextureFactoryIdentifier for the off-main-thread objects to hold on to.
This is turning out to be a big and messy refactoring, so I am looking for an alternative solution.
My understanding is that the DXVA manager asks the WebRenderBridgeChild rather than the ImageBridge about the backend because the former has a better chance of knowing the backend since it is tied to a specific compositor.
On the other hand we don't support having several OMTC compositor backends at the same time. If we fail to create a renderer we fallback to a non-webrender backend for all widgets so it should be safe to ask the compositor backend to the ImageBridge, unless we plan to support having several compositor backends running at the same time that can receive video frames.
Sotaro, am I missing something here? We should get the off-main-thread pieces of media code to only directly interact with the image bridge, either by providing all of the information it needs in the IBC or by providing it in some other thread-safe way. I am hopeful that we can do the former because the latter needs a lot of changes.
Assignee | ||
Comment 13•7 years ago
|
||
Looks like The media code holding non-thread-safe KnowsCompositor implementations may have been introduced 4 months ago in bug 1380234.
Assignee | ||
Comment 14•7 years ago
|
||
> On the other hand we don't support having several OMTC compositor backends at the same time.
So apparently we started at least trying to support that scenario in order to support extensions that need to render a video in a widget that can't hardware acceleration because of transparency on windows.
> so it should be safe to ask the compositor backend to the ImageBridge
Scratch that, I'm going to try a simpler version of my initial attempt.
Assignee | ||
Comment 15•7 years ago
|
||
The idea is to have something that knows about the proper compositor backend oof the main thread without having to hold a strong reference to non-thread-safe actors like WebRenderBridgeChild, and at the same time provide access to the actor that will do the texture allocations (the ImageBridge in this case, hence the class being specific to media).
Ideally we would be more explicit and pass a concrete struct to the media stuff instead of hiding it under KnowsCompositor, but my attempt at doing that bubbled up into a large refactoring so I turned to this instead.
One thing to watch out for during review is that these new KnowsCompositor instances have their own serial (before that the media code would hold on to an actor directly so it would see the serial of WebRenderBridge or ImageBridge, or something else) so there is a potential change of behavior in that regard. I think that it is not an issue because the media code doesn't seem to be using the serial, but if it turns out to be a problem we can make it so that the serial is not constant and have this proxy use the serial of the ImageBridge (or would we use the serial of the WebRenderBridgeChild?).
try looks good: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c99e7f6b31d9e818a2ce35494b105a9eec23ac35
Attachment #8930344 -
Attachment is obsolete: true
Assignee | ||
Comment 16•7 years ago
|
||
Comment on attachment 8933248 [details] [diff] [review]
Add a media-specific KnowsCompositor proxy usable off the main thread
Review of attachment 8933248 [details] [diff] [review]:
-----------------------------------------------------------------
Oops, forgot to set the review flag.
Attachment #8933248 -
Flags: review?(sotaro.ikeda.g)
Reporter | ||
Comment 17•7 years ago
|
||
Comment on attachment 8933248 [details] [diff] [review]
Add a media-specific KnowsCompositor proxy usable off the main thread
Review of attachment 8933248 [details] [diff] [review]:
-----------------------------------------------------------------
If we want to always destroy WebRenderBridgeChild on Main thread, the GetForMedia() needs to be called on Main thread. Since when the GetForMedia() is called off main thread within media framework, a ref of WebRenderBridgeChild is held off main thread.
We also need to add SupportsD3D11() to KnowsCompositor, it was added by Bug 1405562 recently.
::: dom/media/platforms/PlatformDecoderModule.h
@@ +121,5 @@
> void Set(UseNullDecoder aUseNullDecoder) { mUseNullDecoder = aUseNullDecoder; }
> void Set(OptionSet aOptions) { mOptions = aOptions; }
> void Set(VideoFrameRate aRate) { mRate = aRate; }
> void Set(layers::KnowsCompositor* aKnowsCompositor)
> {
This function seems not a good place to call GetForMedia(), since ref of KnowsCompositor is already held at off main thread. Instead MediaDecoder::GetCompositor() is better place to call GetForMedia(). MediaDecoder::GetCompositor() is always called on main thread and after the function call, ref of KnowsCompositor is moved to off main thread.
::: gfx/layers/ipc/ShadowLayers.cpp
@@ +222,5 @@
> +}
> +
> +RefPtr<KnowsCompositor>
> +ShadowLayerForwarder::GetForMedia()
> +{
Can we add ASSERT to check if current thread is main thread?
::: gfx/layers/wr/WebRenderBridgeChild.cpp
@@ +630,5 @@
>
> +
> +RefPtr<KnowsCompositor>
> +WebRenderBridgeChild::GetForMedia()
> +{
Can we add ASSERT to check if current thread is main thread?
Attachment #8933248 -
Flags: review?(sotaro.ikeda.g)
Assignee | ||
Comment 18•7 years ago
|
||
> If we want to always destroy WebRenderBridgeChild on Main thread, the GetForMedia() needs to be called on Main thread. Since when the GetForMedia() is called off main thread within media framework, a ref of WebRenderBridgeChild is held off main thread.
I agree. I thought that the CreateDecoderParam struct was created on the main thread and sent to the media threads to be consumed there, I'll look into a better place to do this and add the assertion you suggested.
Updated•7 years ago
|
Crash Signature: [@ nsObserverService::RemoveObserver]
Updated•7 years ago
|
Blocks: stage-wr-nightly
Assignee | ||
Comment 20•7 years ago
|
||
This version makes sure that GetForMedia is called on the main thread and that CreateDecoderParams only ever get KnowsCompositor objects that advertise being okay to hold from multiple threads.
Attachment #8933248 -
Attachment is obsolete: true
Attachment #8934158 -
Flags: review?(sotaro.ikeda.g)
Reporter | ||
Updated•7 years ago
|
Attachment #8934158 -
Flags: review?(sotaro.ikeda.g) → review+
Comment 21•7 years ago
|
||
Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/49b95b5bf515
Add a Proxy KnowsCompositor implementation that can be used off the main thread. r=sotaro
Comment 22•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Comment 23•7 years ago
|
||
No more crash on nightly 59 since the patch landed.
But still 61 crashes in beta 58 for FennecAndroid (see http://bit.ly/2jwk8dL).
status-firefox58:
--- → affected
Comment 24•7 years ago
|
||
Those Android crashes have a different stack; no WebRenderBridgeChild stack frame. I believe they are covered by https://bugzilla.mozilla.org/show_bug.cgi?id=1276919
Comment 25•7 years ago
|
||
Per comment #24, mark 58 won't fix.
You need to log in
before you can comment on or make changes to this bug.
Description
•