Open Bug 1428132 Opened 6 years ago Updated 2 years ago

MergeStacks can get stuck when pseudo-stack does not start with C++ frame

Categories

(Core :: Gecko Profiler, defect, P5)

defect

Tracking

()

People

(Reporter: jchen, Unassigned)

Details

`MergeStacks` in platform.cpp assumes that the first frame (index 0) of the pseudo-stack is a C++ frame, in order to initialize `lastPseudoCppStackAddr`.

If, however, the first frame is not a C++ frame (or a JS_OSR frame), `pseudoIndex` is never incremented elsewhere, and `lastPseudoCppStackAddr` is never initialized. This results in an infinite loop because the condition `pseudoIndex != pseudoCount` is never satisfied. In debug builds, this should trigger an assertion at [1].

[1] https://searchfox.org/mozilla-central/rev/b24e6342d744c5a83fab5c15972e11eeb69d68e6/tools/profiler/core/platform.cpp#857
I'm not sure it's even possible to get into this state, as a native frame should always be first. I'll mark it as P5 as we can accept a patch to fix this, but I don't think it'll hit that code path. If I'm wrong let's elevate the priority.
Priority: -- → P5
IIRC I was seeing this on worker threads, which don't necessarily start with a native frame.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.