[lxc-devel] liblxc problems

Piotr Bartosiewicz p.bartosiewi at partner.samsung.com
Thu Nov 6 12:10:45 UTC 2014


Hi,

I am trying to use liblxc in my project. Previously I was using libvirt 
and everything was ok, but after switching to lxc I found one issue.
After invoking lxc->start ps shows sth like this:

_ (1) my-process
_   \_ (2) my-process (forked)
_      \_ (3) container-init

The problem is with process (2). It appears that this process holds all 
the file descriptor copied from process (1). In my case it's a real 
problem because one of this file descriptors is a dbus socket and after 
process (1) death, process (2) still holds process (1) dbus name.

After looking into sources I've found a missing piece of code like (as 
opposed to the libvirt):

maxfd = sysconf(_SC_OPEN_MAX);
for (fd = 0; fd < maxfd; fd++)
     close(fd);

And the second problem with start:
My process (1) uses a lot of resources (RAM), process (2) is forked from 
(1). It is not the problem when process (1) is alive (because of 
copy-on-write) but when process (1) die then process (2) uses 
unnecessarily more memory than it should. I propose to use fork+exec here.

Thanks,
Piotrek



More information about the lxc-devel mailing list