public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [Bug 104705] emerge doesn't print complete error message
@ 2005-10-23  6:45 Jason Stubbs
  2005-10-29 10:34 ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
  0 siblings, 1 reply; 24+ messages in thread
From: Jason Stubbs @ 2005-10-23  6:45 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

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

[-- Attachment #2: sigterm-timeout.patch --]
[-- Type: text/x-diff, Size: 822 bytes --]

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)

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2005-10-30  7:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-23  6:45 [gentoo-portage-dev] [Bug 104705] emerge doesn't print complete error message Jason Stubbs
2005-10-29 10:34 ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 10:41   ` [gentoo-portage-dev] [1/7] portage_exec cleanups Jason Stubbs
2005-10-29 10:44   ` [gentoo-portage-dev] [2/7] " Jason Stubbs
2005-10-29 10:49   ` [gentoo-portage-dev] [3/7] " Jason Stubbs
2005-10-29 14:22     ` Brian Harring
2005-10-29 15:06       ` Jason Stubbs
2005-10-29 15:17         ` Brian Harring
2005-10-29 10:52   ` [gentoo-portage-dev] [4/7] " Jason Stubbs
2005-10-29 11:03     ` Jason Stubbs
2005-10-29 10:56   ` [gentoo-portage-dev] [5/7] " Jason Stubbs
2005-10-29 15:25     ` Jason Stubbs
2005-10-29 16:04       ` Brian Harring
2005-10-29 16:40         ` Jason Stubbs
2005-10-29 17:17           ` Jason Stubbs
2005-10-29 17:17           ` Brian Harring
2005-10-29 17:28             ` Jason Stubbs
2005-10-29 17:20           ` Jason Stubbs
2005-10-29 17:28             ` Brian Harring
2005-10-29 10:57   ` [gentoo-portage-dev] [6/7] " Jason Stubbs
2005-10-29 11:01   ` [gentoo-portage-dev] [7/7] " Jason Stubbs
2005-10-29 17:32   ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 17:38     ` Jason Stubbs
2005-10-30  7:03   ` Jason Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox