Crash in gfxPlatform::Init, with MOZ_CRASH(Already started???)

RESOLVED FIXED in Firefox 57

Status

()

Core
Graphics
--
critical
RESOLVED FIXED
10 months ago
9 months ago

People

(Reporter: njn, Assigned: jfkthame)

Tracking

({crash})

Trunk
mozilla57
Unspecified
Mac OS X
crash
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox55 unaffected, firefox56 unaffected, firefox57 fixed)

Details

(crash signature)

Attachments

(1 attachment)

(Reporter)

Description

10 months ago
This bug was filed from the Socorro interface and is 
report bp-8fc557fa-f8f0-448c-8997-efb210170902.
=============================================================

This almost-Mac-only MOZ_CRASH has been around for some time, possibly going back as far as Firefox 47. It's crept up to be a topcrash in recent Mac Nightlies.

Here's a search showing all such crashes over the past month, 59 of them:
https://crash-stats.mozilla.com/signature/?product=Firefox&moz_crash_reason=%3DMOZ_CRASH%28Already%20started%3F%3F%3F%29&signature=gfxPlatform%3A%3AInit&date=%3E%3D2017-08-03T23%3A43%3A24.000Z&date=%3C2017-09-03T23%3A43%3A24.000Z&_columns=date&_columns=product&_columns=version&_columns=build_id&_columns=platform&_columns=reason&_columns=address&_columns=install_time&_sort=-build_id&_sort=-date&page=1#summary

jrmuizel, any ideas?
Flags: needinfo?(jmuizelaar)
The Nightly crashes are mostly inside ShowProfileManager, and look related to Mac fonts. (I'll add this signature to the prefix list.) Looking at the crashes from the last month on Nightly OSX, there was one on the 8-9 build, but then I see 6 on the 8-25 build, and they are much more frequent after that, so maybe this is a regression from bug 1392659 or some of the other recent OSX font work? Could you take a look, Jonathan? Thanks.
Flags: needinfo?(jfkthame)
(Assignee)

Comment 2

10 months ago
Yes, an awful lot of the recent reports seem to have ShowProfileManager() in the stack, which seems curious... running Nightly with the -P flag to show the profile mgr doesn't seem to lead to any problems for me locally.

All the reports I looked at show us apparently handling a change in the installed/registered fonts (gfxMacPlatformFontList::RegisteredFontsChangedNotificationCallback), which would plausibly happen during startup as a result of bug 1392659 (while previously it would have been much less common).

However, what I don't understand is how this can lead to the crash in gfxPlatform::Init, because the gfxPlatformFontList instance is only created later in gfxPlatform::Init, after the static gPlatform has been set. So if the font list exists (and has registered to listen to notifications) we must have already initialized the gfxPlatform, and the gfxPlatform::GetPlatform() call in PurgeSkiaFontCache should just return gPlatform without trying to reinitialize it.


Oh.....one possibility; could it be that this is actually a shutdown-related crash, occurring because we don't remove the callback for kCTFontManagerRegisteredFontsChangedNotification? So if the notification is fired exactly while we're shutting down, maybe that callback gets called after the gfxPlatform has been cleared.

We should remove our listener for the kCTFontManagerRegisteredFontsChangedNotification when gfxMacPlatformFontList is shut down, to avoid any risk of it being called after we are no longer prepared to handle it.
Flags: needinfo?(jfkthame)
(Assignee)

Comment 3

10 months ago
Created attachment 8904610 [details] [diff] [review]
(speculative fix) - Remove the registered-fonts-changed notification observer when shutting down Mac font list, to avoid any risk of being called later during shutdown

I don't know whether this is in fact relevant to the crashes here, but it seems like something we should do for correctness anyway; I'd suggest we keep the bug open until we see whether it helps with crash-stats, though.
Attachment #8904610 - Flags: review?(jmuizelaar)

Updated

10 months ago
Depends on: 1396928
Attachment #8904610 - Flags: review?(jmuizelaar) → review+

Comment 4

10 months ago
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/264087371af5
(speculative fix) - Remove the registered-fonts-changed notification observer when shutting down Mac font list, to avoid any risk of being called later during shutdown. r=jrmuizel
(Assignee)

Updated

10 months ago
Keywords: leave-open
shutdown-progress isn't set in any of these crashes, but we may just not have those annotations set up for the profile manager.
I found two crash reports with user comments, though they aren't very helpful. The first one is a little alarming...
"Computer had kernel crash - now Nightly won't start"
"Clicked on the Nightly icon to launch the browser and then it crashed."
(Assignee)

Comment 8

10 months ago
Crash-stats shows no crashes in builds since this landed (latest build ID with a crash is 20170905220108, and Nightly is now at 20170908100218). So I'm considering this FIXED.
Assignee: nobody → jfkthame
Status: NEW → RESOLVED
Last Resolved: 10 months ago
Flags: needinfo?(jmuizelaar)
Resolution: --- → FIXED
Blocks: 1392659
status-firefox55: --- → unaffected
status-firefox56: --- → unaffected
status-firefox57: affected → fixed
status-firefox-esr52: --- → unaffected
Keywords: leave-open
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.