<div dir="ltr">I will get a small example coded up that repros the problem on my end, then send it to you guys for review.  Thanks!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 6:21 PM, S.Çağlar Onur <span dir="ltr"><<a href="mailto:caglar@10ur.org" target="_blank">caglar@10ur.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi David,<br>
<div class=""><br>
On Mon, Jul 28, 2014 at 10:32 AM, Serge Hallyn <<a href="mailto:serge.hallyn@ubuntu.com">serge.hallyn@ubuntu.com</a>> wrote:<br>
> Quoting David Richardson (<a href="mailto:pudnik019@gmail.com">pudnik019@gmail.com</a>):<br>
>> Yes, I recall reading that the C API should be thread-safe, but I may not<br>
>> be using the ref count primitives correctly?  At any rate, after cloning,<br>
>> starting, stopping, and destroying a few thousand containers from multiple<br>
>> concurrent threads, I eventually end up with a broken config file for a<br>
><br>
> We do test for that in lxc-test-concurrent, and Çaglar does some large<br>
> scale concurrency testing using the go api.  If we can see the code you're<br>
> using that would be helpful.<br>
<br>
</div>[still catching emails so please ignore this if the problem gets resolved]<br>
<br>
Tried doing a similar test using both C and Go but couldn't reproduce<br>
this. Do you mind sharing the code or the exact set of operations that<br>
you are doing?<br>
<div class="HOEnZb"><div class="h5"><br>
>> container that looks like the following example:<br>
>><br>
>> ---------------<br>
>><br>
>> lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0<br>
>> lxc.mount.entry = sysfs sys sysfs defaults 0 0<br>
>> lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none<br>
>> bind,optional 0 0<br>
>> lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0<br>
>> lxc.mount.entry = /sys/kernel/security sys/kernel/security none<br>
>> bind,optional 0 0<br>
>> lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0<br>
>> lxc.tty = 4<br>
>> lxc.pts = 1024<br>
>> lxc.devttydir = lxc<br>
>> lxc.arch = x86_64<br>
>> lxc.cgroup.devices.deny = a<br>
>> lxc.cgroup.devices.allow = c *:* m<br>
>> lxc.cgroup.devices.allow = b *:* m<br>
>> lxc.cgroup.devices.allow = c 1:3 rwm<br>
>> lxc.cgroup.devices.allow = c 1:5 rwm<br>
>> lxc.cgroup.devices.allow = c 5:0 rwm<br>
>> lxc.cgroup.devices.allow = c 5:1 rwm<br>
>> lxc.cgroup.devices.allow = c 1:8 rwm<br>
>> lxc.cgroup.devices.allow = c 1:9 rwm<br>
>> lxc.cgroup.devices.allow = c 5:2 rwm<br>
>> lxc.cgroup.devices.allow = c 136:* rwm<br>
>> lxc.cgroup.devices.allow = c 254:0 rm<br>
>> lxc.cgroup.devices.allow = c 10:229 rwm<br>
>> lxc.cgroup.devices.allow = c 10:200 rwm<br>
>> lxc.cgroup.devices.allow = c 1:7 rwm<br>
>> lxc.cgroup.devices.allow = c 10:228 rwm<br>
>> lxc.cgroup.devices.allow = c 10:232 rwm<br>
>> lxc.utsname = qpJ14Klr8KvP987h<br>
>> lxc.network.type = veth<br>
>> lxc.network.flags = up<br>
>> lxc.network.link = lxcbr0<br>
>> lxc.network.hwaddr = 00:16:3e:04:04:04<br>
>> lxc.cap.drop = sys_module<br>
>> lxc.cap.drop = mac_admin<br>
>> lxc.cap.drop = mac_override<br>
>> lxc.cap.drop = sys_time<br>
>> lxc.rootfs = overlayfslxc.mount.entry = proc proc proc nodev,noexec,nosuid<br>
>> 0 0<br>
>> lxc.mount.entry = sysfs sys sysfs defaults 0 0<br>
>> lxc.mount.entry = /sys/fs/fuse/connections sys/fs/fuse/connections none<br>
>> bind,optional 0 0<br>
>> lxc.mount.entry = /sys/kernel/debug sys/kernel/debug none bind,optional 0 0<br>
>> lxc.mount.entry = /sys/kernel/security sys/kernel/security none<br>
>> bind,optional 0 0<br>
>> lxc.mount.entry = /sys/fs/pstore sys/fs/pstore none bind,optional 0 0<br>
>> lxc.tty = 4<br>
>> lxc.pts = 1024<br>
>> lxc.devttydir = lxc<br>
>> lxc.arch = x86_64<br>
>> lxc.cgroup.devices.deny = a<br>
>> lxc.cgroup.devices.allow = c *:* m<br>
>> lxc.cgroup.devices.allow = b *:* m<br>
>> lxc.cgroup.devices.allow = c 1:3 rwm<br>
>> lxc.cgroup.devices.allow = c 1:5 rwm<br>
>> lxc.cgroup.devices.allow = c 5:0 rwm<br>
>> lxc.cgroup.devices.allow = c 5:1 rwm<br>
>> lxc.cgroup.devices.allow = c 1:8 rwm<br>
>> lxc.cgroup.devices.allow = c 1:9 rwm<br>
>> lxc.cgroup.devices.allow = c 5:2 rwm<br>
>> lxc.cgroup.devices.allow = c 136:* rwm<br>
>> lxc.cgroup.devices.allow = c 254:0 rm<br>
>> lxc.cgroup.devices.allow = c 10:229 rwm<br>
>> lxc.cgroup.devices.allow = c 10:200 rwm<br>
>> lxc.cgroup.devices.allow = c 1:7 rwm<br>
>> lxc.cgroup.devices.allow = c 10:228 rwm<br>
>> lxc.cgroup.devices.allow = c 10:232 rwm<br>
>> lxc.utsname = ubuntu-14.04<br>
>> lxc.network.type = veth<br>
>> lxc.network.flags = up<br>
>> lxc.network.link = lxcbr0<br>
>> lxc.network.hwaddr = 00:16:3e:08:87:51<br>
>> lxc.cap.drop = sys_module<br>
>> lxc.cap.drop = mac_admin<br>
>> lxc.cap.drop = mac_override<br>
>> lxc.cap.drop = sys_time<br>
>> lxc.pivotdir = lxc_putold<br>
>><br>
>> ------------------<br>
>><br>
>> You can see pretty clearly here where things go wrong: the substitution for<br>
>> the rootfs.path into lxc.rootfs = PATH is getting garbled.  In fact, it<br>
>> appears that it is substituting an entire copy of the parent's config file<br>
>> (the clone's parent is named ubuntu-14.04) instead of the correct<br>
>> overlayfs:/path/to/rootfs:/path/to/delta0.  I am running LXC 1.0.4 on an<br>
>> Ubuntu-14.04 host.<br>
>><br>
>> ~Dave<br>
>><br>
>><br>
>> On Tue, Jul 22, 2014 at 9:10 PM, Serge Hallyn <<a href="mailto:serge.hallyn@ubuntu.com">serge.hallyn@ubuntu.com</a>><br>
>> wrote:<br>
>><br>
>> > However if you're using the C api it is meant to be thread-safe.  Which<br>
>> > version are you working with?  I'd love to see the program you're using,<br>
>> > if you don't mind.<br>
>> ><br>
>> > Quoting David Richardson (<a href="mailto:pudnik019@gmail.com">pudnik019@gmail.com</a>):<br>
>> > > Ah, yes, you are right.  Looks like the config file got garbled.  I<br>
>> > suspect<br>
>> > > it's because I am calling the C API's clone method from multiple threads<br>
>> > in<br>
>> > > a racey fashion.  I will look to ensure that any critical sections are<br>
>> > > protected.  Thanks.<br>
>> > ><br>
>> > > ~Dave<br>
>> > ><br>
>> > ><br>
>> > > On Tue, Jul 22, 2014 at 7:26 PM, Serge Hallyn <<a href="mailto:serge.hallyn@ubuntu.com">serge.hallyn@ubuntu.com</a>><br>
>> > > wrote:<br>
>> > ><br>
>> > > > Well, the configuration file is bad.<br>
>> > > ><br>
>> > > > overlayfslxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0<br>
>> > > ><br>
>> > > > is not valid.<br>
>> > > ><br>
>> > > > Please post the configuration file for the original and clone, as well<br>
>> > as<br>
>> > > > the exact way that you created the clone.<br>
>> > > ><br>
>> > > > -serge<br>
>> > > > _______________________________________________<br>
>> > > > lxc-devel mailing list<br>
>> > > > <a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
>> > > > <a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
>> > > ><br>
>> ><br>
>> > > _______________________________________________<br>
>> > > lxc-devel mailing list<br>
>> > > <a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
>> > > <a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
>> ><br>
>> > _______________________________________________<br>
>> > lxc-devel mailing list<br>
>> > <a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
>> > <a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
>> ><br>
><br>
>> _______________________________________________<br>
>> lxc-devel mailing list<br>
>> <a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
>> <a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
><br>
> _______________________________________________<br>
> lxc-devel mailing list<br>
> <a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
S.Çağlar Onur <<a href="mailto:caglar@10ur.org">caglar@10ur.org</a>><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
lxc-devel mailing list<br>
<a href="mailto:lxc-devel@lists.linuxcontainers.org">lxc-devel@lists.linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-devel" target="_blank">http://lists.linuxcontainers.org/listinfo/lxc-devel</a><br>
</div></div></blockquote></div><br></div>