From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yosuke Iwamatsu Subject: [PATCH] xend: Sleep before sending SIGKILL to device model Date: Wed, 28 Jan 2009 17:46:32 +0900 Message-ID: <49801B68.5060700@ab.jp.nec.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090601010800020905050509" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------090601010800020905050509 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit When we destroy a domain, xend sends SIGTERM to the device model and wait by waitpid() until the device model process disappears. If we restarted xend during the lifetime of the domain, waitpid() fails because the device model is no longer a child of xend, and in that case xend gives up waiting for the shutdown of process and just send it SIGKILL immediately. This is problematic because most of the case the device model will be forcibly killed by xend before shutting itself down. This patch adds time.sleep before sending SIGKILL to the device model. On my test box shutdown of a device model usually takes about 0.5 sec, so waiting two seconds should be enough in most cases. Regards, ----------------------- Yosuke Iwamatsu NEC Corporation Signed-off-by: Yosuke Iwamatsu --------------090601010800020905050509 Content-Type: all/allfiles; name="xend_dm_sigkill.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xend_dm_sigkill.patch" xend: Sleep before sending SIGKILL to device model diff -r c9dc7dcacc1d tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Mon Jan 26 11:22:03 2009 +0000 +++ b/tools/python/xen/xend/image.py Wed Jan 28 16:25:06 2009 +0900 @@ -574,7 +574,9 @@ # This is expected if Xend has been restarted within the # life of this domain. In this case, we can kill the process, # but we can't wait for it because it's not our child. - # We just make really sure it's going away (SIGKILL) first. + # We just sleep for a reasonable period of time and + # make really sure it's going away (SIGKILL) first. + time.sleep(2) os.kill(self.pid, signal.SIGKILL) state = xstransact.Remove("/local/domain/0/device-model/%i" % self.vm.getDomid()) --------------090601010800020905050509 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------090601010800020905050509--