diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 22:09:58 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 22:09:58 +0000 |
commit | 50faca730337e5145c58b9a8852be735433c8d77 (patch) | |
tree | e4dab2a083c8836c0a5f1e1ce8f7b5e2e7c2255b /chrome/browser | |
parent | 31f23a35436b79adee1c094f7aa37867496ebd07 (diff) | |
download | chromium_src-50faca730337e5145c58b9a8852be735433c8d77.zip chromium_src-50faca730337e5145c58b9a8852be735433c8d77.tar.gz chromium_src-50faca730337e5145c58b9a8852be735433c8d77.tar.bz2 |
POSIX: Don't spawn zombies.
TEST=Navigate to several different sites and check that no Chrome zombies are roaming around.
BUG=9401
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index a75d9de..462b382 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -661,13 +661,24 @@ void BrowserRenderProcessHost::OnChannelError() { DCHECK(process_.handle()); DCHECK(channel_.get()); - if (base::DidProcessCrash(process_.handle())) { + bool child_exited; + if (base::DidProcessCrash(&child_exited, process_.handle())) { NotificationService::current()->Notify( NotificationType::RENDERER_PROCESS_CRASHED, Source<RenderProcessHost>(this), NotificationService::NoDetails()); } - process_.Close(); + // If the process crashed, then the kernel closed the socket for it and so + // the child has already died by the time we get here. Since DidProcessCrash + // called waitpid with WNOHANG, it'll reap the process. However, if + // DidProcessCrash didn't reap the child, we'll need to in + // ~BrowserRenderProcessHost via ProcessWatcher. So we can't close the handle + // here. + // + // This is moot on Windows where |child_exited| will always be true. + if (child_exited) + process_.Close(); + channel_.reset(); // This process should detach all the listeners, causing the object to be |