Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: content/browser/browser_child_process_host_impl.cc

Issue 2058653002: Ignore kill termination status when shutting down a child process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_child_process_host_impl.cc
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc
index 23f4c05c188a419299b921f272fb2a03e42042ab..a57e1fd6a564dfe05422f2c6c1e26490f3aa9a1f 100644
--- a/content/browser/browser_child_process_host_impl.cc
+++ b/content/browser/browser_child_process_host_impl.cc
@@ -395,6 +395,17 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() {
case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM:
#endif
case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: {
+ // If the IPC channel was disconnected after a shutdown request, we
+ // expect the process to be dead. However, if the IPC channel uses
+ // ChannelMojo, it is not true that the process is dead when the
+ // disconnection event comes in. This is because Mojo does an orderly
+ // shutdown in the child process and so the child may not be dead by the
+ // time we get here. If the child isn't dead, the call to
+ // GetTerminationStatus() above may cause the child to be killed because
+ // GetTerminationStatus(known_dead=true) SIGKILLs the process before
+ // waiting for it.
+ if (child_process_host_->IsShuttingDown())
+ break;
delegate_->OnProcessCrashed(exit_code);
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -417,7 +428,8 @@ void BrowserChildProcessHostImpl::OnChildDisconnected() {
data_.process_type,
PROCESS_TYPE_MAX);
#if defined(OS_CHROMEOS)
- if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM) {
+ if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM &&
+ !child_process_host_->IsShuttingDown()) {
UMA_HISTOGRAM_ENUMERATION("ChildProcess.Killed2.OOM",
data_.process_type,
PROCESS_TYPE_MAX);
« no previous file with comments | « chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698