From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1ETwhq-0000iz-AY for garchives@archives.gentoo.org; Mon, 24 Oct 2005 07:25:18 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j9O6rtxU016916; Mon, 24 Oct 2005 06:53:55 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j9O6rsSv031008 for ; Mon, 24 Oct 2005 06:53:55 GMT Received: from zh034158.ppp.dion.ne.jp ([222.3.34.158] helo=opteron246.suzuki-stubbs.home) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1ETZan-0000RD-2b for gentoo-portage-dev@lists.gentoo.org; Sun, 23 Oct 2005 06:44:29 +0000 Received: by opteron246.suzuki-stubbs.home (Postfix, from userid 1000) id DFE112482CB; Sun, 23 Oct 2005 15:45:16 +0900 (JST) From: Jason Stubbs To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] [Bug 104705] emerge doesn't print complete error message Date: Sun, 23 Oct 2005 15:45:16 +0900 User-Agent: KMail/1.8.92 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_8FzWDnKXXMKfFBL" Message-Id: <200510231545.16596.jstubbs@gentoo.org> X-Archives-Salt: 79b956fc-4739-441a-9089-6aeca04ef016 X-Archives-Hash: c0534c273f87d94ab1ed70c42a2b587f --Boundary-00=_8FzWDnKXXMKfFBL Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Commented on the bug due to reasoning behind this patch. Essentially, SIGTERM is sent to "tee", a WNOHANG waitpid() is performed followed by SIGKILL if it hasn't exited. So if tee doesn't exit immediately upon getting the SIGTERM, its buffers won't get a chance to get to disk due to it being killed. This patch simply adds a 1 second window between the SIGTERM and the SIGKILL. One question; is the waitpid(x,0) necessary in the case where SIGKILL wasn't sent? Is waitpid(x,os.NOHANG) enough to clean up the zombie when SIGTERM succeeds? If so, the waitpid(x,0) could be indented into the "if not timeout:" block. -- Jason Stubbs --Boundary-00=_8FzWDnKXXMKfFBL Content-Type: text/x-diff; charset="us-ascii"; name="sigterm-timeout.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sigterm-timeout.patch" Index: pym/portage_exec.py =================================================================== --- pym/portage_exec.py (revision 2150) +++ pym/portage_exec.py (working copy) @@ -4,7 +4,7 @@ # $Id: /var/cvsroot/gentoo-src/portage/pym/portage_exec.py,v 1.13.2.4 2005/04/17 09:01:56 jstubbs Exp $ -import os,types,atexit,string,stat +import os,types,atexit,string,stat,time import signal import portage_data import portage_util @@ -182,7 +182,13 @@ for x in mypid[0:-1]: try: os.kill(x,signal.SIGTERM) - if os.waitpid(x,os.WNOHANG)[1] == 0: + timeout = 100 + while timeout: + if os.waitpid(x,os.WNOHANG)[1] != 0: + break + time.sleep(0.01) + timeout -= 1 + if not timeout: # feisty bugger, still alive. os.kill(x,signal.SIGKILL) os.waitpid(x,0) --Boundary-00=_8FzWDnKXXMKfFBL-- -- gentoo-portage-dev@gentoo.org mailing list