From 4eb460c474d9dd3b29e99542dd611b21e5843656 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Sat, 29 Oct 2005 12:53:18 +0000 Subject: [PATCH] - initWait(): call 'vwait' without --terminate; this is required to give out a list of processes in _waitForVWait - _waitForVWait(): when 'vwait' returns with 'TIMEOUT', give out the list of current processes and kill the context manually git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2214 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/scripts/vserver.functions | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/util-vserver/scripts/vserver.functions b/util-vserver/scripts/vserver.functions index 8652392..19a8f00 100644 --- a/util-vserver/scripts/vserver.functions +++ b/util-vserver/scripts/vserver.functions @@ -807,9 +807,9 @@ function initWait if $_VSERVER_INFO - FEATURE vwait; then local _is_tmpdir _is_tmpdir=$($_MKTEMPDIR /tmp/vwaitstat.XXXXXX) - + $_NOHUP $_VWAIT --timeout "$VSHELPER_SYNC_TIMEOUT" \ - --terminate --status-fd 3 "$2" \ + --status-fd 3 "$2" \ >>$_is_tmpdir/out 2>$_is_tmpdir/err 3>$_is_tmpdir/fifo & echo "$!" >$_is_tmpdir/pid @@ -818,17 +818,17 @@ function initWait } -## Usage: _waitForVWait +## Usage: _waitForVWait function _waitForVWait { declare -a status - wait "$2" || : - getFileArray status "$1" + wait "$3" || : + getFileArray status "$2" set -- ${status[0]} - case "$1" in + case "$2" in (ERROR) warning $"\ -'vwait' exited with error '$2' which indicates that vserver could not +'vwait' exited with error '$3' which indicates that vserver could not be stopped properly" ;; (FINISHED) ;; @@ -837,10 +837,22 @@ A timeout occured while waiting for the vserver to finish and it was killed by sending a SIGKILL signal. Please investigate the reasons and/or increase the timeout in apps/vshelper/sync-timeout." ;; - (TIMEOUT|\?\?\?|*) warning $"\ + + (TIMEOUT) local procs=$($_VPS axf | $_EGREP -e "^[^ \t]+[ \t]+$S_CONTEXT[ \t]+") + warning $"\ +A timeout occured while waiting for the vserver to finish and it will +be killed by sending a SIGKILL signal. The following process list +might be useful for finding out the reason of this behavior: + +$procs +" + killContext "$S_CONTEXT" 9 + ;; + + (\?\?\?|*) warning $"\ internal error: 'vwait' exited with an unexpected status '$1'; I will try to continue but be prepared for unexpected events." - ;; + ;; esac return 0 @@ -855,7 +867,7 @@ function waitForSync local vwait_pid=$4 if test -d "$vwait_statdir"; then - _waitForVWait "$vwait_statdir/fifo" "$( <$vwait_statdir/pid )" + _waitForVWait "$cfgdir" "$vwait_statdir/fifo" "$( <$vwait_statdir/pid )" elif test -n "$_NEED_VSHELPER_SYNC"; then $_VSHELPER_SYNC "$fifo" "$VSHELPER_SYNC_TIMEOUT" || \ warning $"\ -- 1.8.1.5