test linked against nih-dbus-tool-generated libraryis not thread-safe
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cgmanager (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
dbus (Ubuntu) |
Won't Fix
|
High
|
Unassigned | ||
libnih (Ubuntu) |
Won't Fix
|
High
|
Unassigned | ||
lxc (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
lxcfs (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I've taken the libnih source for trusty, and added '--enable-threads' to the three dh_auto_configure lines in debian/rules, rebuilt ,and installed the result. Then I took the source for cgmanager package, rebuilt, and installed.
Finally I took github.
The cgm-concurrent.c only connects to the cgmanager dbus server, sends a ping method, and disconnects - with one connection per thread.
When I do cgm-concurrent -i 100 -j 30 -c (meaning use 30 threads and do 100 full iterations, and don't do any extra dbus calls), I get pretty random dumps. Here is one example:
(gdb) where
#0 0x00007ffff71c5f79 in __GI_raise (sig=sig@entry=6) at ../nptl/
#1 0x00007ffff71c9388 in __GI_abort () at abort.c:89
#2 0x00007ffff71bee36 in __assert_fail_base (fmt=0x7ffff73104b8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=
file=
#3 0x00007ffff71beee2 in __GI___assert_fail (assertion=
function=
#4 0x00007ffff755f52f in __GI___
#5 0x00007ffff779fa45 in _dbus_platform_
#6 0x00007ffff77943f5 in _dbus_rmutex_lock (mutex=<optimized out>) at ../../dbus/
#7 0x00007ffff7782b40 in dbus_connection
#8 0x00007ffff79bb766 in nih_dbus_setup () from /lib/x86_
#9 0x0000000000401cbe in cgm_dbus_connect ()
#10 0x0000000000401e5d in do_function ()
#11 0x0000000000401ec4 in concurrent ()
#12 0x00007ffff755d182 in start_thread (arg=0x7fffd8ff
#13 0x00007ffff728a12d in clone () at ../sysdeps/
Sometimes they show up in nih_free, where usually the thing being freed has a ->next which points to a member function; sometimes they show up in the dbus library at various points.
I may well be doing something wrong, but I don't know what. If we can't either fix what I'm doing wrong or fix libnih or libdbus (if those are being buggy), then I guess I'll have to mutex the connection among all threads.
Changed in lxc (Ubuntu): | |
importance: | Undecided → Critical |
Changed in cgmanager (Ubuntu): | |
importance: | Undecided → Critical |
Hi Serge,
Looking at nih's configure.ac, you actually want to use '--enable- threading' I think. I've never used this option and tbh wasn't even aware it was there.