Commit ae5b6def authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

Dump gpu process on establish channel timeout

Android has a browser-side timeout for establish channel which is
usually the #1 crash on the stable channel. This CL will try to perform
a DumpWithoutCrashing in the gpu process when this timeout happens to
gather more data.

Bug: 680777
Change-Id: I21e1701c359afc57e31a50403d59ba9a94a2baae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222919Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773783}
parent fb38fa16
...@@ -373,6 +373,12 @@ void BrowserChildProcessHostImpl::HistogramBadMessageTerminated( ...@@ -373,6 +373,12 @@ void BrowserChildProcessHostImpl::HistogramBadMessageTerminated(
void BrowserChildProcessHostImpl::EnableWarmUpConnection() { void BrowserChildProcessHostImpl::EnableWarmUpConnection() {
can_use_warm_up_connection_ = true; can_use_warm_up_connection_ = true;
} }
void BrowserChildProcessHostImpl::DumpProcessStack() {
if (!child_process_)
return;
child_process_->DumpProcessStack();
}
#endif #endif
ChildProcessTerminationInfo BrowserChildProcessHostImpl::GetTerminationInfo( ChildProcessTerminationInfo BrowserChildProcessHostImpl::GetTerminationInfo(
......
...@@ -128,6 +128,7 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl ...@@ -128,6 +128,7 @@ class CONTENT_EXPORT BrowserChildProcessHostImpl
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
void EnableWarmUpConnection(); void EnableWarmUpConnection();
void DumpProcessStack();
#endif #endif
BrowserChildProcessHostDelegate* delegate() const { return delegate_; } BrowserChildProcessHostDelegate* delegate() const { return delegate_; }
......
...@@ -53,6 +53,20 @@ namespace { ...@@ -53,6 +53,20 @@ namespace {
void TimedOut() { void TimedOut() {
LOG(FATAL) << "Timed out waiting for GPU channel."; LOG(FATAL) << "Timed out waiting for GPU channel.";
} }
void DumpGpuStackOnIO() {
GpuProcessHost* host =
GpuProcessHost::Get(GPU_PROCESS_KIND_SANDBOXED, /*force_create=*/false);
if (host) {
host->DumpProcessStack();
}
GetUIThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce(&TimedOut));
}
void TimerFired() {
GetIOThreadTaskRunner({})->PostTask(FROM_HERE,
base::BindOnce(&DumpGpuStackOnIO));
}
#endif // OS_ANDROID #endif // OS_ANDROID
GpuMemoryBufferManagerSingleton* CreateGpuMemoryBufferManagerSingleton( GpuMemoryBufferManagerSingleton* CreateGpuMemoryBufferManagerSingleton(
...@@ -436,7 +450,7 @@ void BrowserGpuChannelHostFactory::RestartTimeout() { ...@@ -436,7 +450,7 @@ void BrowserGpuChannelHostFactory::RestartTimeout() {
#endif #endif
timeout_.Start(FROM_HERE, timeout_.Start(FROM_HERE,
base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds), base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds),
base::BindOnce(&TimedOut)); base::BindOnce(&TimerFired));
#endif // OS_ANDROID #endif // OS_ANDROID
} }
......
...@@ -1072,6 +1072,14 @@ void GpuProcessHost::ForceShutdown() { ...@@ -1072,6 +1072,14 @@ void GpuProcessHost::ForceShutdown() {
process_->ForceShutdown(); process_->ForceShutdown();
} }
void GpuProcessHost::DumpProcessStack() {
#if defined(OS_ANDROID)
if (in_process_)
return;
process_->DumpProcessStack();
#endif
}
void GpuProcessHost::RunService(mojo::GenericPendingReceiver receiver) { void GpuProcessHost::RunService(mojo::GenericPendingReceiver receiver) {
process_->child_process()->BindServiceInterface(std::move(receiver)); process_->child_process()->BindServiceInterface(std::move(receiver));
} }
......
...@@ -104,6 +104,10 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate, ...@@ -104,6 +104,10 @@ class GpuProcessHost : public BrowserChildProcessHostDelegate,
// Forcefully terminates the GPU process. // Forcefully terminates the GPU process.
void ForceShutdown(); void ForceShutdown();
// Dumps the stack of the child process without crashing it.
// Only implemented on Android.
void DumpProcessStack();
// Asks the GPU process to run a service instance corresponding to the // Asks the GPU process to run a service instance corresponding to the
// specific interface receiver type carried by |receiver|. // specific interface receiver type carried by |receiver|.
void RunService(mojo::GenericPendingReceiver receiver); void RunService(mojo::GenericPendingReceiver receiver);
......
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