[lxc-devel] [PATCH 1/2] lxc-start: fix the container leak when daemonize

Stéphane Graber stgraber at ubuntu.com
Sun Jan 19 00:50:57 UTC 2014


On Sat, Jan 18, 2014 at 02:59:58PM +0800, Qiang Huang wrote:
> When start container with daemon model, we'll have a new daemon
> process in lxcapi_start, whose c->numthreads is 2, inherited
> from his father. Even his father return to main(), the
> lxc_container_put won't affect son's numthreads.
> 
> So when daemon stops, he should return to main and do
> lxc_container_put again, rather than exit and leave the
> container alone.
> 
> Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/lxccontainer.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 0bebdff..ddea0d7 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -632,12 +632,10 @@ reboot:
>  		goto reboot;
>  	}
> 
> -	if (daemonize) {
> +	if (daemonize)
>  		lxc_container_put(c);
> -		exit (ret == 0 ? true : false);
> -	} else {
> -		return (ret == 0 ? true : false);
> -	}
> +	
> +	return (ret == 0 ? true : false);
>  }
> 
>  /*
> -- 
> 1.8.3
> 

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140118/49cbf70d/attachment.pgp>


More information about the lxc-devel mailing list