From: Zac Medico Date: Fri, 13 Aug 2010 14:47:56 +0000 (-0700) Subject: Bug #278895 - After EbuildIpcDaemon identifies an ebuild process that X-Git-Tag: v2.2_rc68~244 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9a5f9cf8f6a8ff78cc124c40aaebcedd7be8d059;p=portage.git Bug #278895 - After EbuildIpcDaemon identifies an ebuild process that has left an orphan child process running in the background, generate an eerror message about a 'zombie' process and note the pid. --- diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 913a32d12..c3f539dcd 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -60,6 +60,16 @@ class AbstractEbuildProcess(SpawnProcess): # being killed by a signal. self.cancel() + def _zombie(self): + phase = self._get_phase() + + msg = _("The ebuild phase '%s' appears " + "to have left a zombie process with " + "pid %d.") % (phase, self.pid) + + for l in textwrap.wrap(msg, 72): + eerror(l, phase=phase, key=self.settings.mycpv) + def _pipe(self, fd_pipes): stdout_pipe = fd_pipes.get(1) got_pty, master_fd, slave_fd = \ diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py index b1b5201eb..b6489c393 100644 --- a/pym/_emerge/SubProcess.py +++ b/pym/_emerge/SubProcess.py @@ -61,7 +61,21 @@ class SubProcess(AbstractPollTask): return self.returncode if self._registered: - self.scheduler.schedule(self._reg_id) + if self.cancelled: + timeout = 1000 + self.scheduler.schedule(self._reg_id, timeout=timeout) + if self._registered: + try: + os.kill(self.pid, signal.SIGKILL) + except OSError as e: + if e.errno != errno.ESRCH: + raise + del e + self.scheduler.schedule(self._reg_id, timeout=timeout) + if self._registered: + self._zombie() + else: + self.scheduler.schedule(self._reg_id) self._unregister() if self.returncode is not None: return self.returncode @@ -78,6 +92,9 @@ class SubProcess(AbstractPollTask): return self.returncode + def _zombie(self): + pass + def _unregister(self): """ Unregister from the scheduler and close open files.