From: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
To: Sukadev Bhattiprolu
<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Linux Containers
<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Pavel Emelianov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: pidns memory leak
Date: Tue, 06 Oct 2009 10:18:50 +0200 [thread overview]
Message-ID: <4ACAFD6A.3060008@fr.ibm.com> (raw)
In-Reply-To: <20091006040526.GA22923-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Sukadev Bhattiprolu wrote:
> Daniel Lezcano [dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org] wrote:
>> Hi,
>>
>> I am facing a problem with the pid namespace when I launch the following
>> lxc commands:
>>
>> lxc-execute -n foo sleep 3600 &
>> ls -al /proc/$(pidof lxc-init)/exe && lxc-stop -n foo
>>
>> All the processes related to the container are killed, but there is
>> still a refcount on the pid_namespace which is never released.
>
> Thanks for the bug report.
>
> Did you notice any leak in 'struct pids' also or just the pid_namespace ?
> If the pids are not leaking, this may be slightly different from the problem
> Catalin Marinas ran into:
>
> http://lkml.org/lkml/2009/7/29/406
I am not sure what you mean by 'struct pids' but what I observed is:
pid_2 and pid_namespace (as they are named in /proc/slabinfo) are never
decremented.
> And the pid_namespace does not seem to reproduce for me, with out the
> 'ls -al /proc/...' above, or with the simpler 'ns_exec' approach to
> creating pid namespace.
I tried to write a simpler program but I failed to reproduce it.
> I am going through the code for lxc-execute, but does it remount /proc
> in the container ?
Right, the parent does a clone(NEWMNT|NEWPID|NEWIPC|NEWUTS), wait for
the child while this one (pid 1) 'execs' the lxc-init process. This
program mounts /proc and fork-exec the command passed as parameter (here
'sleep 3600').
Without this intermediate process, the leak *seems* not happening.
If you don't access /proc/<pid>/<file>, the leak is not happening.
So to summarize:
Leak when:
----------
lxc-execute -n foo sleep 3600 &
ls -al /proc/$(pidof sleep)/exe && lxc-stop -n foo
The stop can be done, immediately after looking at the proc file or
later, the leak happens in all the cases.
No leak when:
-------------
lxc-execute -n foo sleep 3600 &
lxc-stop -n foo
I tried to create a simpler program doing the same but that did not
triggered the problem.
-- Daniel
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <dlezcano@fr.ibm.com>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Pavel Emelianov <xemul@openvz.org>,
Sukadev Bhattiprolu <sukadev@us.ibm.com>,
Linux Containers <containers@lists.osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: pidns memory leak
Date: Tue, 06 Oct 2009 10:18:50 +0200 [thread overview]
Message-ID: <4ACAFD6A.3060008@fr.ibm.com> (raw)
In-Reply-To: <20091006040526.GA22923@us.ibm.com>
Sukadev Bhattiprolu wrote:
> Daniel Lezcano [dlezcano@fr.ibm.com] wrote:
>> Hi,
>>
>> I am facing a problem with the pid namespace when I launch the following
>> lxc commands:
>>
>> lxc-execute -n foo sleep 3600 &
>> ls -al /proc/$(pidof lxc-init)/exe && lxc-stop -n foo
>>
>> All the processes related to the container are killed, but there is
>> still a refcount on the pid_namespace which is never released.
>
> Thanks for the bug report.
>
> Did you notice any leak in 'struct pids' also or just the pid_namespace ?
> If the pids are not leaking, this may be slightly different from the problem
> Catalin Marinas ran into:
>
> http://lkml.org/lkml/2009/7/29/406
I am not sure what you mean by 'struct pids' but what I observed is:
pid_2 and pid_namespace (as they are named in /proc/slabinfo) are never
decremented.
> And the pid_namespace does not seem to reproduce for me, with out the
> 'ls -al /proc/...' above, or with the simpler 'ns_exec' approach to
> creating pid namespace.
I tried to write a simpler program but I failed to reproduce it.
> I am going through the code for lxc-execute, but does it remount /proc
> in the container ?
Right, the parent does a clone(NEWMNT|NEWPID|NEWIPC|NEWUTS), wait for
the child while this one (pid 1) 'execs' the lxc-init process. This
program mounts /proc and fork-exec the command passed as parameter (here
'sleep 3600').
Without this intermediate process, the leak *seems* not happening.
If you don't access /proc/<pid>/<file>, the leak is not happening.
So to summarize:
Leak when:
----------
lxc-execute -n foo sleep 3600 &
ls -al /proc/$(pidof sleep)/exe && lxc-stop -n foo
The stop can be done, immediately after looking at the proc file or
later, the leak happens in all the cases.
No leak when:
-------------
lxc-execute -n foo sleep 3600 &
lxc-stop -n foo
I tried to create a simpler program doing the same but that did not
triggered the problem.
-- Daniel
next prev parent reply other threads:[~2009-10-06 8:18 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-02 12:27 pidns memory leak Daniel Lezcano
2009-10-02 12:27 ` Daniel Lezcano
[not found] ` <4AC5F198.2070407-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2009-10-06 4:05 ` Sukadev Bhattiprolu
2009-10-06 4:05 ` Sukadev Bhattiprolu
[not found] ` <20091006040526.GA22923-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-06 8:18 ` Daniel Lezcano [this message]
2009-10-06 8:18 ` Daniel Lezcano
[not found] ` <4ACAFD6A.3060008-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2009-10-08 3:08 ` Sukadev Bhattiprolu
2009-10-08 3:08 ` Sukadev Bhattiprolu
[not found] ` <20091008030828.GA18973-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-08 8:11 ` Daniel Lezcano
2009-10-08 8:11 ` Daniel Lezcano
[not found] ` <4ACD9ECC.90508-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2009-10-09 3:29 ` Sukadev Bhattiprolu
2009-10-09 3:29 ` Sukadev Bhattiprolu
[not found] ` <20091009032928.GA2031-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-09 13:18 ` Daniel Lezcano
2009-10-09 13:18 ` Daniel Lezcano
[not found] ` <4ACF381F.9050808-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2009-10-09 20:38 ` Sukadev Bhattiprolu
2009-10-09 20:38 ` Sukadev Bhattiprolu
[not found] ` <20091009203809.GA12230-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-09 20:50 ` Eric W. Biederman
2009-10-09 20:50 ` Eric W. Biederman
[not found] ` <m18wfkl2bf.fsf-+imSwln9KH6u2/kzUuoCbdi2O/JbrIOy@public.gmane.org>
2009-10-10 1:58 ` Sukadev Bhattiprolu
2009-10-10 1:58 ` Sukadev Bhattiprolu
[not found] ` <20091010015859.GB11904-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-10 2:08 ` Eric W. Biederman
2009-10-10 2:08 ` Eric W. Biederman
2009-10-09 21:54 ` Matt Helsley
2009-10-09 21:54 ` Matt Helsley
2009-10-10 1:32 ` Sukadev Bhattiprolu
2009-10-10 1:32 ` Sukadev Bhattiprolu
[not found] ` <20091010013235.GA11904-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-12 8:41 ` Daniel Lezcano
2009-10-12 8:41 ` Daniel Lezcano
[not found] ` <4AD2EBC7.2020109-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2009-10-14 6:15 ` Sukadev Bhattiprolu
2009-10-14 6:15 ` Sukadev Bhattiprolu
[not found] ` <20091014061533.GA23569-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-11-02 21:33 ` Andrew Morton
2009-11-02 21:33 ` Andrew Morton
2009-11-02 22:38 ` Serge E. Hallyn
2009-11-02 22:47 ` Andrew Morton
2009-11-03 7:24 ` Cedric Le Goater
2009-11-03 8:41 ` Eric W. Biederman
2009-11-03 9:24 ` Cedric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ACAFD6A.3060008@fr.ibm.com \
--to=dlezcano-nmtc/0zbporqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.