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

NEW
Unassigned

Status

()

P5
normal
a year ago
6 months ago

People

(Reporter: jchen, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

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.
You need to log in before you can comment on or make changes to this bug.