[lxc-devel] setns/fork(glibc) weird interaction, lxc-attach may hang sporadically

Christian Seiler christian at iwakd.de
Tue Apr 23 18:21:34 UTC 2013


Hi,

> Hi Christian, I agree we need a short term solution and one that 
> works
> with existing glibcs. My question is if you think that glibc will
> eventually fix this at some point?

Actually, I was just compiling a bug report for glibc and I had another
look at the stack trace - it appears to me that I just looked at the
first thing and it sounded like lock and then looked at the fork
wrapper and saw the IO lock. But apparently the IO lock isn't really
the problem here, at least not up to that point, the problem is
that assert() uses malloc() and thread_atfork() stops malloc() from
being used for safety reasons during the fork and re-enables it
afterwards. So it still is a glibc bug, but a slightly different one.
Fortunately, that one is already fixed in glibc, bug #10560 [1], so
the deadlock I see is because I'm using this on a glibc 2.11.

That said, this doesn't solve the issue of lxc-attach running into an
assert() even though fork() will have worked from a kernel perspective.
Since I've been thinking about this problem, for lxc-attach clone()
appears to be the better candidate anyway (due to CLONE_PARENT), so I'm
going to write a patch for that; but for other users of setns() I agree
that it would be nice to fix, so I've submitted glibc bug report
#15392. [2]

> > I pulled down the most recent
> > core-utils to see if/how they had worked around it but it looks to 
> me
> > like nsenter could possibly run into the same thing unless -F is 
> given.
> > I can try to reproduce the hang with nsenter, which might help
> > encourage glibc to fix it sooner :)
> Sorry, I meant util-linux, not core-utils.

util-linux is affected the same way as far as I can tell (haven't tried
it though), and should run into the assertion and fail for no good
reason.

-- Christian

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=10560
[2] http://sourceware.org/bugzilla/show_bug.cgi?id=15392





More information about the lxc-devel mailing list