[Bug 1294200] Re: test linked against nih-dbus-tool-generated libraryis not thread-safe
Serge Hallyn
1294200 at bugs.launchpad.net
Tue Mar 18 17:37:18 UTC 2014
sadly that did not help, but actually seemed to make it worse (as in,
crashes faster):
[New Thread 0x7ffff6f86700 (LWP 18964)]
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent[Thread 0x7fffd0ff1700 (LWP 18962) exited]
[New Thread 0x7ffff6785700 (LWP 18965)]
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': malloc(): smallbin double linked list corrupted: 0x00007fffd81de510 ***
[New Thread 0x7ffff5f84700 (LWP 18966)]
*** Error in `[New Thread 0x7ffff5783700 (LWP 18967)]
*** Error in `[Thread 0x7ffff6f86700 (LWP 18964) exited]
[Thread 0x7fffd17f2700 (LWP 18963) exited]
[Thread 0x7ffff6785700 (LWP 18965) exited]
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
*** Error in `/home/serge/cgmanager-0.20/tests/cgm-concurrent': corrupted double-linked list: 0x00007fffd81de500 ***
[New Thread 0x7ffff4f82700 (LWP 18968)]
[New Thread 0x7fffeffff700 (LWP 18969)]
[Thread 0x7ffff5783700 (LWP 18967) exited]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff5f84700 (LWP 18966)]
_int_malloc (av=0x7fffd8000020, bytes=8) at malloc.c:3700
(gdb) bt
#0 _int_malloc (av=0x7fffd8000020, bytes=8) at malloc.c:3700
#1 0x00007ffff7212430 in __GI___libc_malloc (bytes=8) at malloc.c:2891
#2 0x00007ffff779a594 in _dbus_string_init_preallocated (str=str at entry=0x7ffff5f83a80, allocate_size=allocate_size at entry=0) at ../../dbus/dbus-string.c:149
#3 0x00007ffff779a5d7 in _dbus_string_init (str=str at entry=0x7ffff5f83a80) at ../../dbus/dbus-string.c:177
#4 0x00007ffff777a849 in send_auth (auth=auth at entry=0x7fffd81e6b30, mech=mech at entry=0x7ffff79b6940 <all_mechanisms>) at ../../dbus/dbus-auth.c:1356
#5 0x00007ffff777c11e in _dbus_auth_client_new () at ../../dbus/dbus-auth.c:2315
#6 0x00007ffff7794b65 in _dbus_transport_init_base (transport=transport at entry=0x7fffd81e6a40, vtable=vtable at entry=0x7ffff79b6d50 <socket_vtable>, server_guid=server_guid at entry=0x0, address=address at entry=0x7ffff5f83ba0)
at ../../dbus/dbus-transport.c:120
#7 0x00007ffff7796897 in _dbus_transport_new_for_socket (fd=fd at entry=28, server_guid=server_guid at entry=0x0, address=address at entry=0x7ffff5f83ba0) at ../../dbus/dbus-transport-socket.c:1262
#8 0x00007ffff779fcfa in _dbus_transport_new_for_domain_socket (path=path at entry=0x617ff0 "/sys/fs/cgroup/cgmanager/sock", abstract=abstract at entry=0, error=error at entry=0x7ffff5f83cc0) at ../../dbus/dbus-transport-unix.c:96
#9 0x00007ffff779ffc9 in _dbus_transport_open_platform_specific (entry=0x7fffd81e1a70, transport_p=0x7ffff5f83cb8, error=0x7ffff5f83cc0) at ../../dbus/dbus-transport-unix.c:263
#10 0x00007ffff7794c1f in _dbus_transport_open (entry=0x7fffd81e1a70, error=error at entry=0x7ffff5f83d50) at ../../dbus/dbus-transport.c:391
#11 0x00007ffff778103b in connection_try_from_address_entry (error=0x7ffff5f83d50, entry=<optimized out>) at ../../dbus/dbus-connection.c:1801
#12 _dbus_connection_open_internal (address=<optimized out>, shared=0, error=0x7ffff5f83df0) at ../../dbus/dbus-connection.c:1870
#13 0x0000000000401c5a in cgm_dbus_connect ()
#14 0x0000000000401e5d in do_function ()
#15 0x0000000000401ec4 in concurrent ()
#16 0x00007ffff755d182 in start_thread (arg=0x7ffff5f84700) at pthread_create.c:312
#17 0x00007ffff728a12d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to libnih in Ubuntu.
https://bugs.launchpad.net/bugs/1294200
Title:
test linked against nih-dbus-tool-generated libraryis not thread-safe
Status in “cgmanager” package in Ubuntu:
New
Status in “dbus” package in Ubuntu:
New
Status in “libnih” package in Ubuntu:
New
Status in “lxc” package in Ubuntu:
New
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.com/cgmanager/cgmanager, copied the
configure.ac, Makefile.am, and tests/cgm-concurrent.c into the
cgmanager package source, and built tests/cgm-concurrent.c.
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 at entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#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=assertion at entry=0x7ffff756793c "mutex->__data.__owner == 0",
file=file at entry=0x7ffff7567908 "../nptl/pthread_mutex_lock.c", line=line at entry=116, function=function at entry=0x7ffff7567a40 <__PRETTY_FUNCTION__.8500> "__pthread_mutex_lock") at assert.c:92
#3 0x00007ffff71beee2 in __GI___assert_fail (assertion=0x7ffff756793c "mutex->__data.__owner == 0", file=0x7ffff7567908 "../nptl/pthread_mutex_lock.c", line=116,
function=0x7ffff7567a40 <__PRETTY_FUNCTION__.8500> "__pthread_mutex_lock") at assert.c:101
#4 0x00007ffff755f52f in __GI___pthread_mutex_lock (mutex=0xfefefefefefefe00) at ../nptl/pthread_mutex_lock.c:116
#5 0x00007ffff779fa45 in _dbus_platform_rmutex_lock (mutex=<optimized out>) at ../../dbus/dbus-sysdeps-pthread.c:156
#6 0x00007ffff77943f5 in _dbus_rmutex_lock (mutex=<optimized out>) at ../../dbus/dbus-threads.c:176
#7 0x00007ffff7782b40 in dbus_connection_get_data (connection=0x7fffc0040e70, slot=0) at ../../dbus/dbus-connection.c:5979
#8 0x00007ffff79bb766 in nih_dbus_setup () from /lib/x86_64-linux-gnu/libnih-dbus.so.1
#9 0x0000000000401cbe in cgm_dbus_connect ()
#10 0x0000000000401e5d in do_function ()
#11 0x0000000000401ec4 in concurrent ()
#12 0x00007ffff755d182 in start_thread (arg=0x7fffd8ff9700) at pthread_create.c:312
#13 0x00007ffff728a12d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cgmanager/+bug/1294200/+subscriptions
More information about the foundations-bugs
mailing list