Closed
Bug 378716
Opened 18 years ago
Closed 17 years ago
Deadlock when _win32_scaled_font_create fails and calls cairo_scaled_font_destroy
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: longsonr, Assigned: MatsPalmgren_bugz)
References
Details
(Keywords: hang, regression, testcase)
Attachments
(3 files, 2 obsolete files)
(deleted),
image/svg+xml
|
Details | |
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
vlad
:
review+
vlad
:
superreview+
vlad
:
approval1.9+
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Comment 1•18 years ago
|
||
testcase asserts in a debug build.
_moz_cairo_set_scaled_font is called with scaled_font = NULL then the line
cr->status = scaled_font->status;
goes boom.
Call stack:
_moz_cairo_set_scaled_font
gfxWindowsFont::SetupCairoFont
gfxFont::Draw
gfxWindowsFont::Draw
gfxTextRun::DrawGlyphs
gfxTextRun::Draw
nsSVGGlyphFrame::LoopCharacters
...
Prior to this
gfxWindowsFont::MakeCairoScaledFont
is called with mAdjustedSize = 0
so the call to cairo_scaled_font_create returns NULL
Updated•17 years ago
|
Severity: normal → critical
Keywords: crash
Summary: Browser crashes with small font-size → Browser crashes with small font-size [@ _moz_cairo_set_scaled_font]
Assignee | ||
Comment 3•17 years ago
|
||
After bug 390476 was fixed it hangs instead.
Assignee | ||
Comment 4•17 years ago
|
||
Assignee | ||
Comment 5•17 years ago
|
||
The hang is a deadlock on _cairo_scaled_font_map_mutex:
_moz_cairo_scaled_font_create() acquires the lock and calls
font_face->backend->scaled_font_create(). We end up in
_win32_scaled_font_create() which fails setup the font
so it calls _moz_cairo_scaled_font_destroy() which tries
to acquire the same mutex and hangs.
Assignee: general → nobody
Component: SVG → GFX: Thebes
QA Contact: ian → thebes
Summary: Browser crashes with small font-size [@ _moz_cairo_set_scaled_font] → Deadlock when _win32_scaled_font_create fails and calls cairo_scaled_font_destroy
Assignee | ||
Comment 6•17 years ago
|
||
FWIW, this fixes it. Or we could make the mutex recursive, if we
have support for that type of mutex.
Uhm, I'm pretty sure we set CAIRO_NO_MUTEX... though now that I look at it, that still creates some variables to use as faux mutexes. Ugh.
Assignee | ||
Comment 8•17 years ago
|
||
Right, it's their "poor man's mutex" that deadlocks on a recursive call from
the same thread. They really should provide a true NOP alternative for
applications that does all Cairo calls from the same thread.
Saves us a few assignments too ;-)
Attachment #275701 -
Attachment is obsolete: true
Attachment #278547 -
Flags: superreview?(vladimir)
Attachment #278547 -
Flags: review?(vladimir)
Comment on attachment 278547 [details] [diff] [review]
patch 2
Can you add a copy of this patch into the gfx/cairo dir, and add a note into the README about what it's for?
Attachment #278547 -
Flags: superreview?(vladimir)
Attachment #278547 -
Flags: superreview+
Attachment #278547 -
Flags: review?(vladimir)
Attachment #278547 -
Flags: review+
Attachment #278547 -
Flags: approval1.9+
Actually, hold on -- I don't think that function should be calling scaled_font_destroy at all.
Comment on attachment 278547 [details] [diff] [review]
patch 2
Yeah, the cairo_scaled_font_destroy (&f->base); should just be a free(f);
Attachment #278547 -
Flags: superreview+
Attachment #278547 -
Flags: review+
Attachment #278547 -
Flags: approval1.9+
Assignee | ||
Comment 12•17 years ago
|
||
Good catch. I think we also need a _cairo_scaled_font_fini in case
_cairo_scaled_font_init succeeded.
I've included the patch in gfx/cairo/ and added an entry in README.
Attachment #278547 -
Attachment is obsolete: true
Attachment #278810 -
Flags: superreview?(vladimir)
Attachment #278810 -
Flags: review?(vladimir)
Attachment #278810 -
Flags: superreview?(vladimir)
Attachment #278810 -
Flags: superreview+
Attachment #278810 -
Flags: review?(vladimir)
Attachment #278810 -
Flags: review+
Attachment #278810 -
Flags: approval1.9+
So do we still need the really-noop mutexes mutex code?
Assignee | ||
Comment 14•17 years ago
|
||
1. it saves a few unnecessary integer read/write ops
2. more importantly, it avoids deadlocking in case there is (or
someone introduces) another recursive path to the same mutex
In theory the mutexes aren't supposed to be recursive; I think a recursive acquisition is supposed to be an error condition. That's the case for the linux mutexes at least, but not for the win32 ones (EnterCriticalSection allows for recursive acquisition). Though the poor man's mutex isn't really doing anyone any favours anyway...
Assignee | ||
Updated•17 years ago
|
Assignee: nobody → mats.palmgren
Assignee | ||
Comment 16•17 years ago
|
||
mozilla/gfx/cairo/cairo/src/cairo-mutex-type-private.h 1.7
mozilla/gfx/cairo/cairo/src/cairo-win32-font.c 1.34
mozilla/gfx/cairo/README 1.62
mozilla/gfx/cairo/scaled-font-create-deadlock.patch 1.1
-> FIXED
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Assignee | ||
Comment 17•12 years ago
|
||
Flags: in-testsuite? → in-testsuite+
Comment 18•12 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•