Closed Bug 1695725 Opened 4 years ago Closed 4 years ago

Crash in [@ mozilla::dom::CanvasRenderingContext2D::EnsureErrorTarget]

Categories

(Core :: Graphics: Canvas2D, defect)

Unspecified
Windows 10
defect

Tracking

()

RESOLVED FIXED
90 Branch
Fission Milestone M7a
Tracking Status
firefox-esr78 --- unaffected
firefox86 --- unaffected
firefox87 --- unaffected
firefox88 --- wontfix
firefox89 --- wontfix
firefox90 --- verified

People

(Reporter: cpeterson, Assigned: bobowen)

References

(Regression)

Details

(Keywords: crash, regression)

Crash Data

Attachments

(2 files)

Fission Crash, all 128 crashes (from 8 installs) have Fission enabled

Potential Startup Crash, more than half of the crashes happened during the first minute after launch

Browser Crash

Crash report: https://crash-stats.mozilla.org/report/index/31cfebc5-28cf-43b5-ac8f-8f42d0210301

Reason: EXCEPTION_ACCESS_VIOLATION_WRITE

Top 10 frames of crashing thread:

0 xul.dll static mozilla::dom::CanvasRenderingContext2D::EnsureErrorTarget dom/canvas/CanvasRenderingContext2D.cpp:5130
1 xul.dll mozilla::dom::CanvasRenderingContext2D::SetErrorState dom/canvas/CanvasRenderingContext2D.cpp:1386
2 xul.dll mozilla::dom::CanvasRenderingContext2D::EnsureTarget dom/canvas/CanvasRenderingContext2D.cpp:1320
3 xul.dll mozilla::dom::CanvasRenderingContext2D::FillRect dom/canvas/CanvasRenderingContext2D.cpp:2605
4 xul.dll mozilla::dom::CanvasRenderingContext2D_Binding::fillRect dom/bindings/CanvasRenderingContext2DBinding.cpp:5913
5 xul.dll mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions> dom/bindings/BindingUtils.cpp:3235
6 xul.dll js::InternalCallOrConstruct js/src/vm/Interpreter.cpp:520
7 xul.dll Interpret js/src/vm/Interpreter.cpp:3243
8 xul.dll js::InternalCallOrConstruct js/src/vm/Interpreter.cpp:552
9 xul.dll JS::Call js/src/jsapi.cpp:2863

All crashes are likely from the same machine: same graphics adapter, same non-en-US locale. crash-stats doesn't track users which means a Firefox update will get picked up as new install.

This must be somehow related to bug 1692894 it landed in build 20210225215504.

From the environment "D2DEnabled":false but "d2d":{"status":"available","version":"1.1"}, which is odd.
It should still just fall back to skia though.

I've tried to recreate by flipping various prefs, but I can't get a crash.

Looking through the URLs of the crashes, they are mostly or entirely individual images files (JPG, PNG, etc.) which is unusual.

For instance: https://www.rt.com/static/img/og-logo-rt.png

Which is just a logo for RT.

It looks like at least one of the crashes is using this image blocking addon, so maybe that's related? https://addons.mozilla.org/en-US/firefox/addon/image-block/

Maybe this should be tracked by a fission milestone?

Flags: needinfo?(cpeterson)
Severity: -- → S3
Priority: -- → P3

This doesn't look like a common crash, but it does look highly correlated to Fission.

Looking at the full stack in the crash report, the JS is being run inside a call to WindowGlobalChild::RecvRawMessage and JSActor::CallReceiveMessage, so I think that means we're running code for a JS window actor, if that helps narrow things down a bit.

This also appears to be a call to CanvasRenderingContext2D_Binding::fillRect().

Looking at the code, if CreateOffscreenCanvasDrawTarget returns null in CanvasRenderingContext2D::EnsureErrorTarget(), then we're going to try to addref a null pointer, which will crash. Maybe that's the issue, though the line numbers are off.

The Graphics critical error section for these crashes all have things like this: |[C0][GFX1]: Failed borrow shared and basic targets. (t=9103.68)

That looks like a failure annotation near the end of CanvasRenderingContext2D::EnsureTarget() so maybe that is related: https://searchfox.org/mozilla-central/rev/5e70cd673a0ba0ad19b662c1cf656e0823781596/dom/canvas/CanvasRenderingContext2D.cpp#1316

Fission Milestone: --- → ?
Flags: needinfo?(cpeterson)

If NS_ADDREF(sErrorTarget); was changed to NS_IF_ADDREF(sErrorTarget); I think we'd avoid crashing, because AFAICT nothing else dereferences sErrorTarget, but I don't know if the resulting behavior would be reasonable or not.

Sending to gfx-triage

@ Bob, could this crash be fallout from your fix for bug 1692894 ("Stop creating Direct3D/2D devices when no longer required in the content process")? 100% of the (1172) Nightly crash reports have Fission enabled, but the ~30 crash reports from DevEdition/Beta and Release don't have Fission enabled.

This crash spiked in 88.0a1 Nightly. The earliest build ID is 20210225215504. Here is the changelog between 2021-02-24 and 2021-02-25, which includes your fix for bug 1692894:

https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b3eb91f0b5a7713390e5016f1f59e3a7f8d9a4f2&tochange=0dbba4cd204153adcf3b8f09c1d27db056470599

Should EnsureErrorTarget handle a null errorTarget in release builds instead of just debug MOZ_ASSERT? Is this an OOM?

https://hg.mozilla.org/mozilla-central/file/f875a4ffd653fb9a1ce1567323598057af32ebf0/dom/canvas/CanvasRenderingContext2D.cpp#l5128

The JSWindowActor message sent is "Browser:Thumbnail:ContentInfo" here:

https://searchfox.org/mozilla-central/rev/a8b75e4ba3f8ddf0e76b42681d0a7b7e78e67730/toolkit/actors/BackgroundThumbnailsChild.jsm#26

Blocks: gfx-triage
Severity: S3 → --
Flags: needinfo?(bobowencode)
Priority: P3 → --
Regressed by: 1692894
Has Regression Range: --- → yes

(In reply to Chris Peterson [:cpeterson] from comment #8)

Sending to gfx-triage

@ Bob, could this crash be fallout from your fix for bug 1692894 ("Stop creating Direct3D/2D devices when no longer required in the content process")? 100% of the (1172) Nightly crash reports have Fission enabled, but the ~30 crash reports from DevEdition/Beta and Release don't have Fission enabled.

Yes, it must be down to this change, I've reproduced by removing skia from gfx.canvas.azure.backends and doing a full screenshot.
I didn't get a visible notification of the crash, the screenshot just doesn't appear.

I'm not sure how this could happen without someone changing that pref.

lsalzman - is there a reason why we shouldn't always fall back to skia even if it is not in the pref?
I guess the other alternative is to just not crash (which we should probably do anyway), but whatever is using the off screen canvas will obviously still fail.

Flags: needinfo?(bobowencode) → needinfo?(lsalzman)

I would not be opposed to forcing mFallbackCanvasBackend to SKIA if it somehow ended up as NONE, if you want to write a patch (or maybe to mSoftwareBackend if you wanted to be generic).

Flags: needinfo?(lsalzman)

(In reply to Lee Salzman [:lsalzman] from comment #10)

I would not be opposed to forcing mFallbackCanvasBackend to SKIA if it somehow ended up as NONE, if you want to write a patch (or maybe to mSoftwareBackend if you wanted to be generic).

Thanks, I'll get onto this tomorrow.

Assignee: nobody → bobowencode
Status: NEW → ASSIGNED
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/055d0eaac283 p1: Use mSoftwareBackend if we don't have a fallback canvas backend. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/2c9e8d26dfcc p2: Guard against a failure to create sErrorTarget in CanvasRenderingContext2D. r=lsalzman
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch

The patch landed in nightly and beta is affected.
:bobowen, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(bobowencode)

Comment on attachment 9217412 [details]
Bug 1695725 p1: Use mSoftwareBackend if we don't have a fallback canvas backend. r=lsalzman!

Beta/Release Uplift Approval Request

  • User impact if declined: It's possible that this can only occur when someone misconfigures a pref, but it means certain features like snapshot can cause a tab crash.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: * remove skia from gfx.canvas.azure.backends pref and restart
  • do a full screenshot
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Very simple changes to always fallback to the same software backend as content and also some additional null checks.
  • String changes made/needed:
Flags: needinfo?(bobowencode)
Attachment #9217412 - Flags: approval-mozilla-beta?
Attachment #9217413 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Fission Milestone: ? → M7a
QA Whiteboard: [qa-triaged]

Hello reproduced the issue with Firefox 88.0a1 (20210301220015) on Windows 10x64 as stated in comment 9 by following the steps from comment 18. The Firefox browser does not crash but Screenshot fails to work with full-page after removing skia from gfx.canvas.azure.backends pref.
Verified fixed with Firefox 90.0a1 (20210428215523) on Windows 10x64, macOS 11.2.3 and Ubuntu 20.04. Screenshot a full-page works as expected while skia is removed from gfx.canvas.azure.backends pref.

Comment on attachment 9217412 [details]
Bug 1695725 p1: Use mSoftwareBackend if we don't have a fallback canvas backend. r=lsalzman!

Bob, we only have one crash in 89 beta with this signature so it seems to me that this is not a good candidate for an uplift in beta and that it can ride the 90 train. Don't hesitate to contact me if you think that I should reconsider my position, thanks!

Attachment #9217412 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
Attachment #9217413 - Flags: approval-mozilla-beta? → approval-mozilla-beta-
No longer blocks: gfx-triage
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: