Closed Bug 1281796 Opened 8 years ago Closed 6 years ago

Crash in mozilla::dom::OffscreenCanvas::ClearResources

Categories

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

50 Branch
Unspecified
macOS
defect

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox50 --- wontfix

People

(Reporter: jujjyl, Assigned: mtseng)

References

Details

(Keywords: crash, Whiteboard: [gfx-noted])

Crash Data

Attachments

(2 files, 1 obsolete file)

Attached file offscreen_canvas_crash.tar.gz (obsolete) —
This bug was filed from the Socorro interface and is 
report bp-1fcacc77-9cb0-4e28-9e7a-4417b2160623.
=============================================================

Deterministically crashes when reloading the page after one run. (watch the screen get cleared first red, then green, then blue, then refresh the page).

Needs pref gfx.offscreencanvas.enabled set to true before running, so this crash doesn't occur in shipping versions yet.
There is an assertion failure printed in console:

Assertion failure: current (GFX: active thread is not current thread.), at /builds/slave/m-cen-m64-ntly-000000000000000/build/src/dom/canvas/OffscreenCanvas.cpp:96
#01: _ZN7mozilla20DOMEventTargetHelper7ReleaseEv[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x1d47827]
#02: _ZN7mozilla15SegmentedVectorI8nsCOMPtrI11nsISupportsELm4096ENS_17MallocAllocPolicyEE8PopLastNEj[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x66f12]
#03: _ZN7mozilla3dom21DeferredFinalizerImplI11nsISupportsE16DeferredFinalizeEjPv[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x5a03e]
#04: _ZN7mozilla27IncrementalFinalizeRunnable10ReleaseNowEb[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x5a7ab]
#05: _ZN7mozilla23CycleCollectedJSRuntime4OnGCE10JSGCStatus[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x5924a]
#06: _ZN2js2gc9GCRuntime7gcCycleEbRNS_11SliceBudgetEN2JS8gcreason6ReasonE[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x3cc7de7]
#07: _ZN2js2gc9GCRuntime7collectEbNS_11SliceBudgetEN2JS8gcreason6ReasonE[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x3cc8271]
#08: _ZN2js2gc9GCRuntime2gcE18JSGCInvocationKindN2JS8gcreason6ReasonE[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x3cc8626]
#09: _ZN9JSRuntimeD2Ev[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x3e0d289]
#10: _Z17JS_DestroyRuntimeP9JSRuntime[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x3c4b5d6]
#11: _ZN7mozilla23CycleCollectedJSRuntimeD2Ev[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x57543]
#12: _ZN12_GLOBAL__N_127WorkerThreadPrimaryRunnable3RunEv[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x23399bf]
#13: _ZN8nsThread16ProcessNextEventEbPb[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0xc53e8]
#14: _Z19NS_ProcessNextEventP9nsIThreadb[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0xf3013]
#15: _ZN7mozilla3ipc28MessagePumpForNonMainThreads3RunEPN4base11MessagePump8DelegateE[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x63ebab]
#16: _ZN11MessageLoop3RunEv[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0x5d5419]
#17: _ZN8nsThread10ThreadFuncEPv[/Applications/FirefoxNightly.app/Contents/MacOS/XUL +0xc3d29]
#18: _pt_root[/Applications/FirefoxNightly.app/Contents/MacOS/libnss3.dylib +0x2328fa]
#19: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x39b1]
#20: _pthread_body[/usr/lib/system/libsystem_pthread.dylib +0x392e]
Flags: needinfo?(howareyou322)
Morris, is this related to multiple workers for WebGL offscreen feature?
Assignee: nobody → mtseng
Flags: needinfo?(howareyou322)
Yeah, the test page uses new the OffscreenCanvas (spec in draft stage) feature. We are prototyping support for OffscreenCanvas into Emscripten, discussed in https://github.com/kripken/emscripten/pull/4412, so this is getting some stress testing there.

Acknowledged that this is not a shipping feature yet, but a spec-in-progress, so this is aimed for the experimental Emscripten developers.
Whiteboard: [gfx-noted]
Hey, things are starting to look interesting with this crash. Just recently one of our partners reported that their Unity game is crashing, and looking locally at the test build they sent me, I can reproduce a crash which looks like

https://crash-stats.mozilla.com/report/index/654adc20-c36f-41e2-97fb-f45492161006

The crash signature is the same as from comment 0.

This occurred on OS X, and the curious thing is that the page does not use OffscreenCanvas, and the Offscreen canvas pref gfx.offscreencanvas.enabled is set to false on my test system where the crash occurred.

That makes this look like the inactive OffscreenCanvas feature can crash pages that don't use it, so hoping to bump the priority of this bug. Morris, any chance you might have a cycle or two?
Flags: needinfo?(mtseng)
Sure, I can check this. Do you have any test case or website to reproduce this?
Flags: needinfo?(mtseng) → needinfo?(jujjyl)
See the attachment in this bug. I'm hopeful that that reproduces the same issue than the full game page that the partner is using since the call trace is the same. That test case does need the OffscreenCanvas pref enabled. Hopefully it's something relatively simple, I can then ask the developer for a test case to verify if it works in their case or not.
Flags: needinfo?(jujjyl)
FWIW, I can't reproduce anything "bad" with the attached example.
(In reply to Milan Sreckovic [:milan] from comment #7)
> FWIW, I can't reproduce anything "bad" with the attached example.

In particular, neither OffscreenCanvas constructor nor destructor got called.
Jukka, I cannot run the attached example. It always shows "Thread 5337144: Could not create canvas: ?,TypeError: canvas is undefined". I have turned "gfx.offscreencanvas.enabled" on. Does it need additional setup?
Flags: needinfo?(jujjyl)
Attached file Proper test case
Ops, I seem to have uploaded some total garbage files that aren't the test case at all! Very sorry about that!

Here's a test case that does reproduce for me on OS X. Needs to enable the offscreencanvas pref.

The STR is to open the html file, wait until it says 

    Thread 3 started: you should see the WebGL canvas fade from black to blue.
    Thread quit

and then F5 reload the page. The reloaded page will run for a second or two, and then the crash occurs.

Here's a crash report with the contents from the zip file:

https://crash-stats.mozilla.com/report/index/c034b81c-5874-4d5e-aeb2-a35d32161018
Attachment #8764597 - Attachment is obsolete: true
Flags: needinfo?(jujjyl)
Jukka, thanks for the test case. I can reproduce the crash using this test case. I'll debug it.
Can you find someone better to review this? I don't know this code, and would have to look around a bit to review it.
Flags: needinfo?(mtseng)
Comment on attachment 8802214 [details]
Bug 1281796 - Clear the remained resources when offscreencanvas get neutered.

https://reviewboard.mozilla.org/r/86686/#review90528
Attachment #8802214 - Flags: review?(jgilbert) → review+
Closing because no crashes reported for 12 weeks.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Flags: needinfo?(mephisto41)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: