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 /chrome/browser/zygote_main_linux.cc | |
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
Diffstat (limited to 'chrome/browser/zygote_main_linux.cc')
-rw-r--r-- | chrome/browser/zygote_main_linux.cc | 9 |
1 files changed, 8 insertions, 1 deletions
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) |