From 26a76970d89c416371e3e411234a12356b2437d0 Mon Sep 17 00:00:00 2001 From: marko Date: Wed, 27 Jul 2005 05:40:10 +0000 Subject: [PATCH] A race condition could occur in vimageCleanup when processes inside a dying vimage would be shutting down too slow. This would occur particularly often with XORP. The vimage shutdown is now performed in a loop to ensure we do not proceed further until the cleanup has completely succedded. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- exec.tcl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exec.tcl b/exec.tcl index dff4ddf..9b88a37 100755 --- a/exec.tcl +++ b/exec.tcl @@ -323,13 +323,17 @@ proc vimageCleanup {} { # Shut down all vimages foreach vimage $vimages { - statline "Shutting down vimage $vimage" + set stattxt "Shutting down vimage $vimage" + statline $stattxt catch {nexec vimage $vimage kill -9 -1 2> /dev/null} + while { [catch {nexec vimage -d $vimage}] } { + set stattxt $stattxt. + statline $stattxt + catch {nexec vimage $vimage kill -9 -1 2> /dev/null} + } nexec rm -fr /tmp/$vimage - nexec vimage -d $vimage } catch { nexec rm -f /usr/local/etc/quagga/Quagga.conf } - catch { nexec rm -f /usr/local/xorp/config.boot } catch { nexec mv /etc/resolv.conf.bak /etc/resolv.conf } statline "Cleanup completed in [expr [clock seconds] - $t_start] seconds." } -- 2.39.5