Commit 882149ae authored by Aaron Colwell's avatar Aaron Colwell Committed by Commit Bot

Log more information in rph_with_bc_reference crash key.

Adding more logging information to make it easier to determine why
the RenderProcessHostImpl is still alive. All the new values are related
to the various early return paths in RPHI::Cleanup() that cause
destruction to get deferred.


Bug: 1113159
Change-Id: I6dbf6966ca91681aed0c853605f1be9d736b80a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360473
Auto-Submit: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Commit-Queue: Aaron Colwell <acolwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798883}
parent ccc1ba01
......@@ -487,24 +487,14 @@ BrowserContext::~BrowserContext() {
std::string rph_crash_key_value;
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
for (RenderProcessHost::iterator host_iterator =
RenderProcessHost::AllHostsIterator();
!host_iterator.IsAtEnd(); host_iterator.Advance()) {
RenderProcessHost* host = host_iterator.GetCurrentValue();
if (host->GetBrowserContext() == this) {
rph_crash_key_value += "{";
rph_crash_key_value +=
" pl='" + policy->GetProcessLock(host->GetID()).ToString() + "'";
if (host->HostHasNotBeenUsed())
rph_crash_key_value += " hnbu";
if (RenderProcessHostImpl::IsSpareProcessForCrashReporting(host))
rph_crash_key_value += " spr";
rph_crash_key_value += " }";
"{ " + host->GetInfoForBrowserContextDestructionCrashReporting() +
" }";
}
}
if (!rph_crash_key_value.empty()) {
......
......@@ -2221,6 +2221,33 @@ void RenderProcessHostImpl::
cleanup_network_service_plugin_exceptions_upon_destruction_ = true;
}
std::string
RenderProcessHostImpl::GetInfoForBrowserContextDestructionCrashReporting() {
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
std::string ret = " pl='" + policy->GetProcessLock(GetID()).ToString() + "'";
if (HostHasNotBeenUsed())
ret += " hnbu";
if (IsSpareProcessForCrashReporting(this))
ret += " spr";
if (delayed_cleanup_needed_)
ret += " dcn";
if (keep_alive_ref_count_ != 0)
ret += " karc=" + base::NumberToString(keep_alive_ref_count_);
if (!listeners_.IsEmpty())
ret += " lsn=" + base::NumberToString(listeners_.size());
if (deleting_soon_)
ret += " ds";
return ret;
}
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
void RenderProcessHostImpl::DumpProfilingData(base::OnceClosure callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
......
......@@ -275,6 +275,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
mojo::PendingReceiver<blink::mojom::IDBFactory> receiver) override;
void ForceCrash() override;
void CleanupNetworkServicePluginExceptionsUponDestruction() override;
std::string GetInfoForBrowserContextDestructionCrashReporting() override;
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
void DumpProfilingData(base::OnceClosure callback) override;
#endif
......
......@@ -549,6 +549,11 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
// RenderProcessHostImpl::AddCorbExceptionForPlugin).
virtual void CleanupNetworkServicePluginExceptionsUponDestruction() = 0;
// Returns a string that contains information useful for debugging
// crashes related to RenderProcessHost objects staying alive longer than
// the BrowserContext they are associated with.
virtual std::string GetInfoForBrowserContextDestructionCrashReporting() = 0;
#if BUILDFLAG(CLANG_PROFILING_INSIDE_SANDBOX)
// Ask the renderer process to dump its profiling data to disk. Invokes
// |callback| once this has completed.
......
......@@ -480,6 +480,11 @@ void MockRenderProcessHost::BindIndexedDB(
void MockRenderProcessHost::
CleanupNetworkServicePluginExceptionsUponDestruction() {}
std::string
MockRenderProcessHost::GetInfoForBrowserContextDestructionCrashReporting() {
return std::string();
}
void MockRenderProcessHost::FilterURL(bool empty_allowed, GURL* url) {
RenderProcessHostImpl::FilterURL(this, empty_allowed, url);
}
......
......@@ -217,6 +217,7 @@ class MockRenderProcessHost : public RenderProcessHost {
override {}
void CleanupNetworkServicePluginExceptionsUponDestruction() override;
std::string GetInfoForBrowserContextDestructionCrashReporting() override;
// IPC::Sender via RenderProcessHost.
bool Send(IPC::Message* msg) override;
......
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