Commit 7b88e3eb authored by Gabriel Charette's avatar Gabriel Charette

Revert "Remove hang watching of deprecated BrowserThreads."

This reverts commit 91c22dbf.

Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=768886#c34

I'm puzzled as to why but it seems removing hang watching of unused BrowserThreads causes a spike in hang reports of remaining watched threads...

Original change's description:
> Remove hang watching of deprecated BrowserThreads.
> 
> This is a partial reland of https://chromium-review.googlesource.com/c/chromium/src/+/705775
> 
> That CL caused issue 768886 (spike in hang reports). I suspect this
> was caused by a change in enum IDs rather than this change to the
> hang watching code and this CL will help narrow down the cause.
> 
> R=​asvitkine@chromium.org
> 
> NOPRESUBMIT=TRUE (shuffling of code using deprecated BrowserThread IDs)
> 
> Bug: 689520,768886
> Change-Id: Id7bf1c7b5f5d34c4b1e7b1e71e9b015725695997
> Reviewed-on: https://chromium-review.googlesource.com/743846
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#512509}

TBR=gab@chromium.org,asvitkine@chromium.org
NOPRESUBMIT=TRUE

Skipping CQ checks because CL landed > 1 day ago.

Bug: 689520, 768886
Change-Id: I164eceed2a2354b3fa82d6ff73899417530aa3a5
Reviewed-on: https://chromium-review.googlesource.com/747661
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512907}
parent 863386d2
......@@ -466,11 +466,13 @@ void ThreadWatcherList::ParseCommandLine(
crash_on_hang_thread_names =
command_line.GetSwitchValueASCII(switches::kCrashOnHangThreads);
} else if (channel != version_info::Channel::STABLE) {
// Default to crashing the browser if UI or IO threads are not responsive
// except in stable channel.
crash_on_hang_thread_names =
base::StringPrintf("UI:%d:%d,IO:%d:%d", kLiveThreadsThreshold,
crash_seconds, kLiveThreadsThreshold, crash_seconds);
// Default to crashing the browser if UI or IO or FILE threads are not
// responsive except in stable channel.
crash_on_hang_thread_names = base::StringPrintf(
"UI:%d:%d,IO:%d:%d,FILE:%d:%d",
kLiveThreadsThreshold, crash_seconds,
kLiveThreadsThreshold, crash_seconds,
kLiveThreadsThreshold, crash_seconds * 5);
}
ParseCommandLineCrashOnHangThreads(crash_on_hang_thread_names,
......@@ -550,6 +552,12 @@ void ThreadWatcherList::InitializeAndStartWatching(
unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime,
unresponsive_threshold, crash_on_hang_threads);
}
// static
......
......@@ -50,12 +50,36 @@ NOINLINE void ThreadUnresponsive_UI() {
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_DB() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_FILE() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_FILE_USER_BLOCKING() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_PROCESS_LAUNCHER() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_CACHE() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
ReportThreadHang();
}
NOINLINE void ThreadUnresponsive_IO() {
volatile int inhibit_comdat = __LINE__;
ALLOW_UNUSED_LOCAL(inhibit_comdat);
......@@ -67,16 +91,19 @@ NOINLINE void CrashBecauseThreadWasUnresponsive(
switch (thread_id) {
case content::BrowserThread::UI:
return ThreadUnresponsive_UI();
case content::BrowserThread::DB:
return ThreadUnresponsive_DB();
case content::BrowserThread::FILE:
return ThreadUnresponsive_FILE();
case content::BrowserThread::FILE_USER_BLOCKING:
return ThreadUnresponsive_FILE_USER_BLOCKING();
case content::BrowserThread::PROCESS_LAUNCHER:
return ThreadUnresponsive_PROCESS_LAUNCHER();
case content::BrowserThread::CACHE:
return ThreadUnresponsive_CACHE();
case content::BrowserThread::IO:
return ThreadUnresponsive_IO();
case content::BrowserThread::ID_COUNT:
// TODO(gab): Get rid of deprecated BrowserThread IDs.
case content::BrowserThread::DB:
case content::BrowserThread::FILE:
case content::BrowserThread::FILE_USER_BLOCKING:
case content::BrowserThread::CACHE:
NOTREACHED();
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment