diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-26 02:35:45 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-26 02:35:45 +0000 |
commit | 073040b43c8d3c01c7019ee7ef3e8664f137f5b6 (patch) | |
tree | 245726bffad858f7d368199b671b26970c5431bc | |
parent | 7f51255c5711efe3cfccebe15e0213364c1273e8 (diff) | |
download | chromium_src-073040b43c8d3c01c7019ee7ef3e8664f137f5b6.zip chromium_src-073040b43c8d3c01c7019ee7ef3e8664f137f5b6.tar.gz chromium_src-073040b43c8d3c01c7019ee7ef3e8664f137f5b6.tar.bz2 |
Linux: Fix problem with zombies and hanging browsers when METHOD_GET_CHILD_WITH_INODE fails.
BUG=none
TEST=fewer zombies.
Review URL: http://codereview.chromium.org/3416023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60592 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/render_sandbox_host_linux.cc | 3 | ||||
-rw-r--r-- | chrome/browser/zygote_host_linux.cc | 2 | ||||
-rw-r--r-- | chrome/browser/zygote_main_linux.cc | 9 |
3 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc index 39a3d9e..bcd63d8 100644 --- a/chrome/browser/renderer_host/render_sandbox_host_linux.cc +++ b/chrome/browser/renderer_host/render_sandbox_host_linux.cc @@ -343,8 +343,9 @@ class SandboxIPCProcess { base::StringToInt(inode_output, &pid); if (!pid) { + // Even though the pid is invalid, we still need to reply to the zygote + // and not just return here. LOG(ERROR) << "Could not get pid"; - return; } Pickle reply; diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index f01bcf1..5ef002f 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -234,6 +234,8 @@ pid_t ZygoteHost::ForkRenderer( if (ReadReply(&pid, sizeof(pid)) != sizeof(pid)) return base::kNullProcessHandle; + if (pid <= 0) + return base::kNullProcessHandle; } // 1) You can't change the oom_adj of a non-dumpable process (EPERM) unless diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc index 64ec0f7..65a44ae 100644 --- a/chrome/browser/zygote_main_linux.cc +++ b/chrome/browser/zygote_main_linux.cc @@ -246,7 +246,7 @@ class Zygote { int dummy_fd; ino_t dummy_inode; int pipe_fds[2] = { -1, -1 }; - base::ProcessId pid; + base::ProcessId pid = 0; dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0); if (dummy_fd < 0) { @@ -304,6 +304,11 @@ class Zygote { void* iter2 = NULL; if (!reply.ReadInt(&iter2, &real_pid)) goto error; + if (real_pid <= 0) { + // METHOD_GET_CHILD_WITH_INODE failed. Did the child die already? + LOG(ERROR) << "METHOD_GET_CHILD_WITH_INODE failed"; + goto error; + } real_pids_to_sandbox_pids[real_pid] = pid; if (HANDLE_EINTR(write(pipe_fds[1], "x", 1)) != 1) { LOG(ERROR) << "Failed to synchronise with child process"; @@ -314,6 +319,8 @@ class Zygote { } error: + if (pid > 0) + waitpid(pid, NULL, WNOHANG); if (dummy_fd >= 0) close(dummy_fd); if (pipe_fds[0] >= 0) |