[lxc-devel] [PATCH] fix fd leak in test-concurrent

Serge Hallyn serge.hallyn at ubuntu.com
Mon Mar 10 14:58:11 UTC 2014


Quoting S.Çağlar Onur (caglar at 10ur.org):
> On Fri, Mar 7, 2014 at 5:12 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> > Quoting Dwight Engen (dwight.engen at oracle.com):
> >> Opening a debug log for every thread at every iteration of test-concurrent
> >> causes it to quickly run out of fd's because this fd is leaked. Fix this
> >> by adding a new api: lxc_log_close().
> >>
> >> As Caglar noted, the log handling is in general a bit "interesting" because
> >> a logfile can be opened through the per-container api
> >> c->set_config_item("lxc.logfile") but lxc_log_fd is now per-thread data. It
> >> just so happens in test-concurrent that there is a 1:1 mapping of threads
> >> to logfiles.
> >
> > Will at_exit work at thread exit?
> >
> >> Split out getting debug logs from quiet since I think they are useful
> >> separately. If debug is specified, get a log of any mode, not just during
> >> start.
> >>
> >> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> 
> Looks like we are also leaking cgmanager connections, this is while
> test-concurrent is running (it eventual run out of fds and fails)
> 
> [caglar at oOo:~/Projects/lxc(master)] sudo ls /proc/2063/fd -al | wc -l
> 874
> [caglar at oOo:~/Projects/lxc(master)] sudo ls /proc/2063/fd -al | wc -l
> 879
> [caglar at oOo:~/Projects/lxc(master)] sudo ls /proc/2063/fd -al | wc -l
> 889
> [caglar at oOo:~/Projects/lxc(master)] cat /proc/net/unix | grep cgmanager | wc -l
> 878
> [caglar at oOo:~/Projects/lxc(master)] cat /proc/net/unix | grep cgmanager | wc -l
> 888
> [caglar at oOo:~/Projects/lxc(master)] cat /proc/net/unix | grep cgmanager | wc -l
> 893
> [caglar at oOo:~/Projects/lxc(master)]

Can we handle both with pthread_cleanup_push()?

(I'll try in a few hours unless I see a patch beforehand :)

-serge


More information about the lxc-devel mailing list