Closed Bug 1460697 Opened 6 years ago Closed 6 years ago

MOZ_PROFILER_SHUTDOWN crash in ExtensionPolicyService from locked_profiler_stream_json_for_this_process

Categories

(Core :: Gecko Profiler, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: BenWa, Assigned: canova)

Details

Attachments

(2 files)

Attached file backtrace
Backtrace attached.

STR is:
$ MOZ_PROFILER_STARTUP=true MOZ_PROFILER_SHUTDOWN=file.sps /Applications/Firefox\ Nightly.app/Contents/MacOS/firefox

This is easier to setup automation because right now WebDriver can't call nsIProfiler.
This is an assertion in:

https://searchfox.org/mozilla-central/rev/babf96cf0c37b608e9663e2af73a4d21819c4af1/toolkit/components/extensions/ExtensionPolicyService.cpp#80

ExtensionPolicyService::ExtensionPolicyService()
{
  mObs = services::GetObserverService();
  MOZ_RELEASE_ASSERT(mObs);

Kris, since you wrote this code, do you have any ideas on what is the right fix here?
Flags: needinfo?(kmaglione+bmo)
Priority: -- → P2
It looks like the profiler is trying to collect metadata very late in the process shutdown cycle. At that point, the cached policy service singleton has been cleared, and XPCOM has been shutdown, so it can't initialize a new one.

That's a bit worrisome, really. It seems like the profiler shouldn't be trying to collect metadata that late, since it will be, at most, incomplete and possibly inaccurate.

But I guess to solve the immediate problem, we could just check whether XPCOM shutdown has already started, and skip gathering extension metadata if it has.
Flags: needinfo?(kmaglione+bmo)
Assignee: nobody → canaltinova
Hi kmag,
I fixed it with checking if XPCOM is shutting down and if so skipping collecting the extension metadata.
I also tried to figure out and fix the problem fundamentally (about profiler trying to collect metadata very late) for a while. Maybe we can open a new bug for that?
Comment on attachment 8976155 [details]
Bug 1460697 - Do not collect extension metadata for profiler while XPCOM is shutting down

https://reviewboard.mozilla.org/r/244356/#review250458

Thanks
Attachment #8976155 - Flags: review?(kmaglione+bmo) → review+
Pushed by canaltinova@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/c4d7c1c6757e
Do not collect extension metadata for profiler while XPCOM is shutting down r=kmag
https://hg.mozilla.org/mozilla-central/rev/c4d7c1c6757e
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: