[lxc-users] Killing the parent process of a container

Andy Johnson johnsonzjo at gmail.com
Tue Jan 14 02:55:13 UTC 2014


Hello,
It seems to me that it does not reach at all to the
list_active_containers()
https://github.com/lxc/lxc/blob/master/src/lxc/lxccontainer.c#L3224

>From what I see, the lxc entries exists under the /sys/fs/cgroup/ hirerachies
after killing the parent. And lxc-ls is a Bah shell script which
parses these entries, and since there are
/sys/fs/cgroup/<hirerachyName>/lxc/<containerName> entries, it shows
that containerName as active in lxc-ls --active.
Conversely, when stopping the container normally with lxc-stop -n
<containerName> these entries are removed.

Regards,
Andy

On Sun, Jan 12, 2014 at 9:56 PM, Cal Leeming [Simplicity Media Ltd]
<cal.leeming at simplicitymedialtd.co.uk> wrote:
> The lxc-ls command fetches its information here;
> https://github.com/lxc/lxc/blob/master/src/lxc/lxccontainer.c#L3224
>
> It seems to do some checks against `/proc/net/unix`, however I'm not entire
> clear on the logic.
>
> I suspect that lxc-start actually maintains some sort of state file
> somewhere which defines if the container is started or not, rather than
> checking if the lxc-start pid exists, but a core dev will need to clarify
> this.
>
> You could possibly do a manual check to see if the pid exists in the mean
> time.
>
> Hope this helps a bit
>
> Cal
>
>
> On Sat, Jan 11, 2014 at 7:17 AM, Andy Johnson <johnsonzjo at gmail.com> wrote:
>>
>> Hello,
>>
>> I start a busybox container by:
>> lxc-start -n busyboxCTNew
>>
>> from another terminal I get the pid of the parent process of the container
>> by :
>> psaux | grep lxc-start
>>
>> root      1994  0.0  0.0  26092  1304 pts/1    S+   09:04   0:00
>> lxc-start -n busyboxCTNew
>>
>> I run:
>> kill -9 1994
>>
>> (I know that containers should be stopped with lxc-stop for graceful
>> shutdown).
>>
>> From the container, I see:
>> can't open /dev/tty1: Input/output error
>> Killed
>>
>> And the containers shell does not show anymore (we return to the host
>> shell)
>>
>> However, if I run
>> lxc-ls --active
>> I get:
>> busyboxCTNew
>>
>>
>> Why does lxc-ls --active still shows the busyboxCTNew container as
>> active ?  (I get the same result also when trying  10 minutes after
>> running the "kill -9" command).
>>
>>
>> Regards,
>> Andy
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>
>
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list