Closed Bug 1806932 Opened 2 years ago Closed 2 years ago

Crash in [@ mozilla::ThreadEventTarget::Dispatch] from GradientCache::NotifyHandlerEndLocked

Categories

(Core :: Graphics: Canvas2D, defect)

Unspecified
Windows 11
defect

Tracking

()

RESOLVED FIXED
110 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox108 --- wontfix
firefox109 --- wontfix
firefox110 --- fixed

People

(Reporter: mccr8, Assigned: lsalzman)

References

Details

(Keywords: crash, topcrash)

Crash Data

Attachments

(1 file)

Crash report: https://crash-stats.mozilla.org/report/index/8227801f-9f65-4c99-8bf6-676de0221219

MOZ_CRASH Reason: MOZ_DIAGNOSTIC_ASSERT(false) (Attempt to dispatch to thread which does not usually process dispatched runnables until shutdown)

Top 10 frames of crashing thread:

0  xul.dll  mozilla::ThreadEventTarget::Dispatch  xpcom/threads/ThreadEventTarget.cpp:80
0  xul.dll  nsThread::Dispatch  xpcom/threads/nsThread.cpp:674
1  xul.dll  NS_DispatchToCurrentThread  xpcom/threads/nsThreadUtils.cpp:208
2  xul.dll  mozilla::gfx::GradientCache::NotifyHandlerEndLocked  gfx/thebes/gfxGradientCache.cpp:224
3  xul.dll  mozilla::gfx::GradientCache::LookupOrInsert  gfx/thebes/gfxGradientCache.cpp:169
3  xul.dll  mozilla::gfx::gfxGradientCache::GetOrCreateGradientStops  gfx/thebes/gfxGradientCache.cpp:272
4  xul.dll  mozilla::layers::CanvasTranslator::GetOrCreateGradientStops  gfx/layers/ipc/CanvasTranslator.cpp:522
5  xul.dll  mozilla::gfx::RecordedGradientStopsCreation::PlayEvent const  gfx/2d/RecordedEventImpl.h:3258
6  xul.dll  std::_Func_class<bool, mozilla::gfx::RecordedEvent*>::_Empty const  /builds/worker/fetches/vs/vc/tools/msvc/14.16.27023/include/functional:1283
6  xul.dll  std::_Func_class<bool, mozilla::gfx::RecordedEvent*>::operator const  /builds/worker/fetches/vs/vc/tools/msvc/14.16.27023/include/functional:15732480

From Nika in bug 1806751 comment #5:

It looks like there is some code which uses NS_DispatchToCurrentThread when on a threadpool, which is definitely broken, and is probably best fixed by someone on the graphics team figuring out what the actual behaviour it should have is.

This is the only instance I see of this particular crash so far, so apparently it isn't common.

The bug is linked to a topcrash signature, which matches the following criterion:

  • Top 10 AArch64 and ARM crashes on nightly

:lsalzman, could you consider increasing the severity of this top-crash bug?

For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Keywords: topcrash

This is not actually a top crash, it just has the same signature as one (bug 1806751).

Flags: needinfo?(lsalzman)

Bob, it looks like you were the one who added the threading to gfxGradientCache. Can you take a look?

Flags: needinfo?(bobowencode)

As far as I remember, when this was originally added it was running on the main thread in the content process.
Then I also used it in the canvas playback, which is running in a thread pool and runs into this new assertion.

lsalzman: do you think that we could drop the GradientStops on a background thread?

nika: if not is there a simple way to submit to the current thread or pool depending on which you are in?

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

Maybe try just dispatching those always to the main thread? I thiiiiink it might work just fine since we're already using ThreadSafeWeakPtr/ref-counting on those.

Flags: needinfo?(lsalzman)

(In reply to Bob Owen (:bobowen) from comment #5)

nika: if not is there a simple way to submit to the current thread or pool depending on which you are in?

No there is no way to submit to either the current thread or current thread pool depending on which you are in right now. If you want to have thread-like behaviour on a threadpool, I recommend creating a TaskQueue to run events on and using that instead.

Flags: needinfo?(nika)
Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9231302514fc Destroy GradientCacheData on main thread. r=bobowen
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 110 Branch

Seems like this is fairly successfully weeding out the assertions so far without noticeable collateral damage. The remaining crash signatures on Android seem to be from a completely different caller, not the gfxGradientCache.

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

Seems like this is fairly successfully weeding out the assertions so far without noticeable collateral damage. The remaining crash signatures on Android seem to be from a completely different caller, not the gfxGradientCache.

Looks like there are/were some from Linux as well, I don't know if these have been dealt with already.

Though again these are not from GradientCache.

Yeah, the gradient cache ones seem to be fixed. Thanks for your quick work there. The remaining ones look to all be Service::Observe related, which is being addressed in bug 1806751.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: