aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-13 14:47:56 (GMT)
committerZac Medico <zmedico@gentoo.org>2010-08-13 14:47:56 (GMT)
commit9a5f9cf8f6a8ff78cc124c40aaebcedd7be8d059 (patch)
tree5b77dab8cb645ebca3405e9650d8eeaf197f02b2
parentUse EbuildIpcDaemon to replace the functionality of (diff)
downloadportage-9a5f9cf8f6a8ff78cc124c40aaebcedd7be8d059.zip
portage-9a5f9cf8f6a8ff78cc124c40aaebcedd7be8d059.tar.gz
portage-9a5f9cf8f6a8ff78cc124c40aaebcedd7be8d059.tar.bz2
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.
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py10
-rw-r--r--pym/_emerge/SubProcess.py19
2 files changed, 28 insertions, 1 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 913a32d..c3f539d 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 b1b5201..b6489c3 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.