Subject: Re: [vserver] Debian Squeeze guest system: processed getting killed too quickly
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Tue, 8 Mar 2011 13:24:34 +0100

On Thu, Feb 24, 2011 at 09:23:55AM +0100, Markus Fischer wrote:
> Hi,

> I've created a fresh Debian Squeeze guest and notices that the processes 
> do not have enough time to properly shutdown themselves upon receiving 
> their signal. Here is how stopping such a vserver looks like:

> --------------------------------8<------------------------------
> markus@server02:~$ sudo vserver qa01 stop
> Using makefile-style concurrent boot in runlevel 6.
> Stopping MTA: exim4_listener.
> mount: permission denied
> Stopping MySQL database server: mysqld.
> Stopping web server: apache2 ... waiting .
> Stopping Tomcat servlet engine: tomcat6.
> Killing Xvnc4 process ID 12357
> Sleeping for one second before killing all processes from user 'vnc' ... 
> ... (warning).
> Will now restart.
> Asking all remaining processes to terminate...done.
> All processes ended within 1 seconds....done.
> /usr/lib/util-vserver/vserver.stop: line 98: 13261 Killed 
>    "${IONICE_CMD[@]}" "${NICE_CMD[@]}" "${CHBIND_CMD[@]}" "$_VSPACE" 
> --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" -- "$_VTAG" --migrate 
> "${OPTS_VTAG_ENTER[@]}" --silent -- $_VCONTEXT $SILENT_OPT --migrate 
> $OPT_VCONTEXT_CHROOT --xid "$S_CONTEXT" -- "${INITCMD_STOP[@]}"
> --------------------------------8<------------------------------

> or this output (the difference is the order of the MySQL database server):

> --------------------------------8<------------------------------
> markus@server02:~$ time sudo vserve qa01 stop
> sudo: vserve: command not found
> markus@server02:~$ sudo vserver qa01 stop
> Using makefile-style concurrent boot in runlevel 6.
> Stopping MTA: exim4_listener.
> mount: permission denied
> Stopping web server: apache2 ... waiting .
> Stopping Tomcat servlet engine: tomcat6.
> Killing Xvnc4 process ID 7976
> Sleeping for one second before killing all processes from user 'vnc' ... 
> ... (warning).
> Will now restart.
> Stopping MySQL database server: 
> mysqld/usr/lib/util-vserver/vserver.stop: line 98:  8126 Killed 
>          "${IONICE_CMD[@]}" "${NICE_CMD[@]}" "${CHBIND_CMD[@]}" 
> "$_VSPACE" --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" -- "$_VTAG" 
> --migrate "${OPTS_VTAG_ENTER[@]}" --silent -- $_VCONTEXT $SILENT_OPT 
> --migrate $OPT_VCONTEXT_CHROOT --xid "$S_CONTEXT" -- "${INITCMD_STOP[@]}"
> 
> real    0m3.356s
> user    0m0.072s
> sys     0m0.116s
> --------------------------------8<------------------------------

> I *think* this is related to the new way of squeeze starts/stops the 
> processes, but I barely managed to understand the new system at all.

> I'm concerned that important processes get prematurely killed and thus 
> experience data loss because I've only seen this last line:

> /usr/lib/util-vserver/vserver.stop: line 98:  8126 Killed 
>    "${IONICE_CMD[@]}" "${NICE_CMD[@]}" "${CHBIND_CMD[@]}" "$_VSPACE" 
> --enter "$S_CONTEXT" "${OPTS_VSPACE[@]}" -- "$_VTAG" --migrate 
> "${OPTS_VTAG_ENTER[@]}" --silent -- $_VCONTEXT $SILENT_OPT --migrate 
> $OPT_VCONTEXT_CHROOT --xid "$S_CONTEXT" -- "${INITCMD_STOP[@]}"

> when processes take unusually long to shutdown. But in this case the 
> system is fresh, the database is empty and as can bee seen the whole 
> stop process doesn't take longer then 3.3s and yet I get this line.

> Q1: do I have to be concerned about this?

it looks like something is killing the vserver script not
the other way round, which could be kernel/tool related
(i.e. what kernel/patch/util-vserver version do you have?)

> Q2: can I fix this someway? 
> I.e. give the guest processes enough time to shutdown?

there is a timeout value (in the config) which tells
util-vserver how long to wait for a guest (on shutdown)
before killing off its processes 

HTH,
Herbert

> thanks,
> - Markus