Enabling the profiler hits JS_ASSERT(installed());

RESOLVED FIXED

Status

()

Core
Gecko Profiler
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: dhylands, Unassigned)

Tracking

unspecified
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

6 years ago
I tried building from Mozilla-Inbound and when I run b2g with MOZ_PROFILER_STARTUP=1 then I hit the assert at:

js/src/vm/SPSProfiler.cpp:58

Backtrace:

#0  js::SPSProfiler::enable (this=0xa5a5b025, enabled=true) at /home/work/mozilla-inbound/js/src/vm/SPSProfiler.cpp:58
#1  0x418715b0 in js::EnableRuntimeProfilingStack (rt=<value optimized out>, enabled=true) at /home/work/mozilla-inbound/js/src/jsfriendapi.cpp:900
#2  0x4133ae28 in ProfileStack::enableJSSampling (aProfileEntries=<value optimized out>, aInterval=<value optimized out>, aFeatures=<value optimized out>, aFeatureCount=1)
    at /home/work/mozilla-inbound/tools/profiler/sps_sampler.h:351
#3  mozilla_sampler_start (aProfileEntries=<value optimized out>, aInterval=<value optimized out>, aFeatures=<value optimized out>, aFeatureCount=1)
    at /home/work/mozilla-inbound/tools/profiler/TableTicker.cpp:1100
#4  0x4133af7a in mozilla_sampler_init () at /home/work/mozilla-inbound/tools/profiler/TableTicker.cpp:1012
#5  0x4082f1c8 in XREMain::XRE_main (this=0xa5a5b025, argc=1, argv=0x3, aAppData=0x1) at /home/work/mozilla-inbound/toolkit/xre/nsAppRunner.cpp:3798
#6  0x4082f52a in XRE_main (argc=1, argv=0xbebaebb4, aAppData=0xb1c0, aFlags=<value optimized out>) at /home/work/mozilla-inbound/toolkit/xre/nsAppRunner.cpp:3923
#7  0x00008af4 in do_main (argc=1, argv=0xbebaebb4) at /home/work/mozilla-inbound/b2g/app/nsBrowserApp.cpp:153
#8  main (argc=1, argv=0xbebaebb4) at /home/work/mozilla-inbound/b2g/app/nsBrowserApp.cpp:229

From what I can gather, SPSProfiler::setProfilingStack or SetRuntimeProfilingStack needs to be called. I couldn't find any calls to either of these functions outside of the ones in js/src/jsapi-tests/testProfileStrings.cpp, or a call to EnableSPSProfilingAssertions (or the JS enableSPSProfilingAssertions)
(Reporter)

Comment 1

6 years ago
I should mention that I hit the assert when using a DEBUG build. Everything seems to work fine with a non-DEBUG build, which suggests that the ASSERT may be superfluous.
We shouldn't be calling js::EnableRuntimeProfilingStack this early on startup. We need to wait until the JS engine is ready and has given us a context. See:
http://mxr.mozilla.org/mozilla-central/source/tools/profiler/sps_sampler.h#349

I think we just forgot to init mRuntime to null. I'm surprised this hasn't come up in fennec before.
Created attachment 664855 [details] [diff] [review]
patch

I'm traveling and don't have access to b2g hardware. Can you test this patch for me?
(Reporter)

Comment 4

6 years ago
I removed the errant semi-colon from the patch, and it still asserts in the exact same place.
Alright well I think we want this patch anyways so let's land it but keep going with this bug.
Comment on attachment 664855 [details] [diff] [review]
patch

Ignore the extra ';'
Attachment #664855 - Flags: review?(ehsan)

Updated

6 years ago
Blocks: 758697

Updated

6 years ago
Attachment #664855 - Flags: review?(ehsan) → review+
Created attachment 666595 [details] [diff] [review]
Initialize mRuntime

Carry forward r+
Attachment #664855 - Attachment is obsolete: true
Attachment #666595 - Flags: review+

Updated

6 years ago
Whiteboard: [leave open]
(Reporter)

Comment 10

6 years ago
I thought I'd mention that I'm not seeing the assert any more.

I think it's possible I applied the patch in a source tree different from the one I was building - Sigh.

Updated

5 years ago
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED

Updated

5 years ago
Whiteboard: [leave open]
You need to log in before you can comment on or make changes to this bug.