Bug 1113416 - Don't read stack labels inside hang monitor sighandler; r=nfroyd r=snorp

When we're inside the hang monitor's signal handler, we must not read any string labels. Doing so may result in on-demand decompression kicking in on Android, which may result in a deadlock.
This commit is contained in:
Jim Chen 2015-01-10 12:41:48 -05:00
parent 3e54f20e33
commit c2e9cb1c30
2 changed files with 8 additions and 3 deletions

View File

@ -360,6 +360,13 @@ BackgroundHangThread::ReportHang(PRIntervalTime aHangTime)
// Recovered from a hang; called on the monitor thread
// mManager->mLock IS locked
// Remove unwanted "js::RunScript" frame from the stack
for (const char** f = &mHangStack.back(); f >= mHangStack.begin(); f--) {
if (!mHangStack.IsInBuffer(*f) && !strcmp(*f, "js::RunScript")) {
mHangStack.erase(f);
}
}
Telemetry::HangHistogram newHistogram(Move(mHangStack));
for (Telemetry::HangHistogram* oldHistogram = mStats.mHangs.begin();
oldHistogram != mStats.mHangs.end(); oldHistogram++) {

View File

@ -673,10 +673,8 @@ ThreadStackHelper::FillStackBuffer()
}
#endif
const char* const label = entry->label();
if (mStackToFill->IsSameAsEntry(prevLabel, label) ||
!strcmp(label, "js::RunScript")) {
if (mStackToFill->IsSameAsEntry(prevLabel, label)) {
// Avoid duplicate labels to save space in the stack.
// Avoid js::RunScript labels because we save actual JS frames above.
continue;
}
mStackToFill->infallibleAppend(label);