public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] SpawnProcess: re-check cgroup.procs until empty (bug 566420)
Date: Sat, 21 Nov 2015 11:42:08 -0800	[thread overview]
Message-ID: <1448134928-17323-1-git-send-email-zmedico@gentoo.org> (raw)

For subshell die support (bug 465008), we need to re-check cgroup.procs
until it's empty, in case any of the listed processes fork before we've
had a chance to kill them.

X-Gentoo-Bug: 566420
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=566420
---
 pym/_emerge/SpawnProcess.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py
index 5ab2e67..b27be2f 100644
--- a/pym/_emerge/SpawnProcess.py
+++ b/pym/_emerge/SpawnProcess.py
@@ -203,10 +203,13 @@ class SpawnProcess(SubProcess):
 						elif e.errno != errno.ESRCH:
 							raise
 
-			# step 1: kill all orphans
-			pids = get_pids(self.cgroup)
-			if pids:
-				kill_all(pids, signal.SIGKILL)
+			# step 1: kill all orphans (loop in case of new forks)
+			while True:
+				pids = get_pids(self.cgroup)
+				if pids:
+					kill_all(pids, signal.SIGKILL)
+				else:
+					break
 
 			# step 2: remove the cgroup
 			try:
-- 
2.4.9



             reply	other threads:[~2015-11-21 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-21 19:42 Zac Medico [this message]
2015-11-22  0:00 ` [gentoo-portage-dev] [PATCH v2] SpawnProcess: re-check cgroup.procs until empty (bug 566420) Zac Medico
2015-11-23 10:32   ` Alexander Berntsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448134928-17323-1-git-send-email-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox