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

Serge Hallyn serge.hallyn at ubuntu.com
Sat Mar 8 00:10:15 UTC 2014


Quoting Dwight Engen (dwight.engen at oracle.com):
> On Fri, 7 Mar 2014 16:12:23 -0600
> 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?
> 
> I don't think it does. I thought a little about trying to do the close
> automatically internal to lxc on the last ref in lxc_container_put()
> but that doesn't really make sense. I guess that's what seems weird to
> me, that opening the log is via a per-container api, but logging is
> really per-process (or per-thread with Caglar's recent change).

Yeah.  fwiw sorting this out *is* on the 2.0 roadmap :)  There *must*
be a clean way of framing this, I just haven't seen it yet.

-serge


More information about the lxc-devel mailing list