Closed Bug 1888634 Opened 7 months ago Closed 7 months ago

OffscreenCanvas Codepen demo sometimes completely freezes the tab for 10-15 seconds

Categories

(Core :: Graphics: Canvas2D, defect, P3)

defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox124 --- unaffected
firefox125 --- wontfix
firefox126 --- fixed
firefox127 --- fixed

People

(Reporter: mayankleoboy1, Assigned: aosmond)

References

(Regressed 1 open bug, Regression, )

Details

(Keywords: regression)

Attachments

(3 files)

This may be easier to repro with gpu-canvas enabled.

  1. Download the attached demo and save it to your local machine (original demo at https://codepen.io/rroyerrivard/pen/jOwBLbB may not work)
    1.5 Open the testcase on your machine. .
  2. Allow the page access to your camera permanently
  3. Click on the first button "Start Worker"
  4. Switch to another tab for 10-15 seconds
  5. Switch back to the demo tab and wait for 3-4 seconds
  6. Rapidly click on the second button "Add Canvas to page" 10-15 times
    If it doesnt repro, close the browser and open the testcase again.

AR: The page freezez
ER: Not so

Profile with all threads, IPC and File IO: https://share.firefox.dev/3VIWuxH
Profile with gfx preset logging: https://share.firefox.dev/4cBrBAX
Profile with webrtc preset logging: https://share.firefox.dev/3x8VxUU

Can only repro about 50% of the time so cannot find a regression range. Not even sure if this is a canvas or webrtc bug or something else.

Attached file about:support

FWIW, I also got drive crash/reset on two occasions while testing this.
Here is a crash report generated on force crashing : https://crash-stats.mozilla.org/report/index/1c14fcbe-ef0a-432a-9966-423d50240329

gfx-log:
(#0) Error Killing GPU process due to IPC reply timeout
(#1) Error Failed as lost WebRenderBridgeChild.
(#2) Error Fallback WR to SW-WR + D3D11
(#3) Error Fallback SW-WR + D3D11 to SW-WR
(#4) Error CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#5) Error CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#6) Error CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#7) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#8) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#9) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#10) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#11) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown
(#12) CP+[GFX1-]: Failed as lost WebRenderBridgeChild.
(#13) CP+[GFX1-]: CompositorBridgeChild receives IPC close with reason=AbnormalShutdown

Alternate STR2:

Download the attached demo and save it to your local machine
Open the testcase on your machine. Allow the page access to your camera permanently
Press-and-hold the "f5" key on your keyboard so that the the page reloads rextremely rapidly. Let this continue for 4-5 seconds.
Click on the first button "Start Worker"
Rapidly click on the second button "Add Canvas to page" 10-15 times

Alternate STR3:
Open the testcase from your local machine
Click on start the worker and click on add a canvas
Start rapidly resizing the browser window diagonally. Keep on resizing till you notice that the video has frozen.

Does this still happen now that bug 1887729 landed?

Flags: needinfo?(mayankleoboy1)

Note that the codepen doesn't need to use oncontextlost/restored to benefit from the improvement where we avoid the freezing after a GPU process crash.

(In reply to Andrew Osmond [:aosmond] (he/him) from comment #5)

Does this still happen now that bug 1887729 landed?

I have the latest Nightly from this: https://hg.mozilla.org/mozilla-central/rev/4120fb3d12f57159ca2e6809f555312e00adda5d and I can still repro, I just tried the STR3 and the tab froze.
(bug 1887729 appears to have landed about 2 nightlies prior)

Flags: needinfo?(mayankleoboy1) → needinfo?(aosmond)

I can reproduce on macOS using STR in comment 0, and I get the hang the very first time I click "Add canvas to page". In fact, the highlight on the button is never cleared. I will attempt a mozregression.

Weirdly, mozregression points to Bug 1806400. I'll do another mozregression to double-check.

A more careful mozregression indicates Bug 1855742, which makes a lot more sense.

Severity: -- → S3
Keywords: regression
Priority: -- → P3
Regressed by: 1855742

Set release status flags based on info from the regressing bug 1855742

I am speculating that this is caused by us clearing out the tab cache (i.e. the ClearCachedResources path), we end up using a stale remote texture ID somehow, and block in the RemoteTextureMap code:
https://searchfox.org/mozilla-central/rev/c09764753ea40725eb50decad2c51edecbd33308/gfx/layers/RemoteTextureMap.cpp#988

Actually this is related to capture stream. The test case is a bit contrived in that it feeds the capture stream back into the canvas.

Flags: needinfo?(aosmond)
Assignee: nobody → aosmond
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1855742

Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/59e2426d20ae Disallow captureStream with canvas transferred to DOM worker. r=gfx-reviewers,lsalzman

Was the demo in comment 0 reduced from a live site or...? Would be nice to better understand how the testcase was found/created to assess the real-world impact of this bug.

Flags: needinfo?(mayankleoboy1)

(In reply to Ryan VanderMeulen [:RyanVM] from comment #17)

Was the demo in comment 0 reduced from a live site or...? Would be nice to better understand how the testcase was found/created to assess the real-world impact of this bug.

I just search for "offscreen-canvas" on Codepen, and test all the results that come up.
I am not the author of the demo in comment 0, and I dont know if this is related to any real site or not.

Flags: needinfo?(mayankleoboy1)

My understanding is that use of captureStream is fairly niche.

Comment on attachment 9396923 [details]
Bug 1888634 - Disallow captureStream with canvas transferred to DOM worker.

Beta/Release Uplift Approval Request

  • User impact if declined: Sites using captureStream with canvases transferred to a DOM worker will encounter bugs. Should be uncommon. Behaviour not defined by spec, although there is meeting notes indicating this will change in the future.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Just disables captureStream from working in conjunction with a DOM worker transferred canvas. This configuration should be rare as its behaviour is not specified by the spec yet.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9396923 - Flags: approval-mozilla-beta?
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch

Comment on attachment 9396923 [details]
Bug 1888634 - Disallow captureStream with canvas transferred to DOM worker.

Approved for 126.0b3

Attachment #9396923 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Regressions: 1894696
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: