[PATCH] Fix a pthreadpool race

Gary Lockyer gary at catalyst.net.nz
Mon Dec 11 17:57:22 UTC 2017


Stack trace with symbols attached.

Cheers
Gary

On 11/12/17 21:53, Volker Lendecke via samba-technical wrote:
> On Mon, Dec 11, 2017 at 04:25:14PM +1300, Gary Lockyer via samba-technical wrote:
>> Ok I've managed to get to this to dead lock on our cloud. The build I've
>> been testing sets socket close exec. But I don't see how this would
>> impact the pthread cmocka tests.
>>
>> stack trace attached.
> 
> Do you have full debug symbols available, so that we can see the full
> stacktrace including source code files and line numbers?
> 
> Thanks, Volker
> 
-------------- next part --------------
[New LWP 17589]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
__lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
135	../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file or directory.
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
No locals.
#1  0x00002b0be953b649 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#2  0x00002b0be953b470 in __GI___pthread_mutex_lock (mutex=0x5628a58978a0) at ../nptl/pthread_mutex_lock.c:79
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = 4294966784
#3  0x00005628a4ef2250 in pthreadpool_destroy (pool=0x5628a5897890) at ../lib/pthreadpool/pthreadpool.c:360
        ret = -375558449
        ret1 = 11019
        __PRETTY_FUNCTION__ = "pthreadpool_destroy"
#4  0x00005628a4ef31bf in pthreadpool_tevent_destructor (pool=0x5628a5897860) at ../lib/pthreadpool/pthreadpool_tevent.c:111
        state = 0x5628a5897860
        next = 0x5628a5897800
        glue = 0x0
        ret = 0
#5  0x00002b0be939c6a6 in _tc_free_internal (tc=0x5628a5897800, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1078
        d = 0x5628a4ef319c <pthreadpool_tevent_destructor>
        ptr_to_free = 0x5628a5897e40
        ptr = 0x5628a5897860
#6  0x00002b0be939d8c8 in _tc_free_children_internal (tc=0x5628a58974d0, ptr=0x5628a5897530, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1593
        child = 0x5628a5897860
        new_parent = 0x0
#7  0x00002b0be939c861 in _tc_free_internal (tc=0x5628a58974d0, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1104
        ptr_to_free = 0x1000
        ptr = 0x5628a5897530
#8  0x00002b0be939d8c8 in _tc_free_children_internal (tc=0x5628a5897210, ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1593
        child = 0x5628a5897530
        new_parent = 0x0
#9  0x00002b0be939c861 in _tc_free_internal (tc=0x5628a5897210, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1104
        ptr_to_free = 0x0
        ptr = 0x5628a5897270
#10 0x00002b0be939ca2c in _talloc_free_internal (ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1174
        tc = 0x5628a5897210
#11 0x00002b0be939dce7 in _talloc_free (ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1716
        tc = 0x5628a5897210
#12 0x00005628a4ef136c in teardown_pthreadpool_tevent (state=0x5628a58971e0) at ../lib/pthreadpool/tests_cmocka.c:60
        t = 0x5628a5897270
#13 0x00002b0be93776e1 in cmocka_run_one_test_or_fixture (function_name=0x5628a4ef4073 "test_create", test_func=0x0, setup_func=0x0, teardown_func=0x5628a4ef133b <teardown_pthreadpool_tevent>, state=0x5628a58971e0, heap_check_point=0x2b0be94fe198) at ../third_party/cmocka/cmocka.c:2628
        check_point = 0x2b0be94fe198
        handle_exceptions = 1
        current_state = 0x0
        rc = 0
#14 0x00002b0be9377a0d in cmocka_run_one_tests (test_state=0x5628a58971d0) at ../third_party/cmocka/cmocka.c:2752
        start = {tv_sec = 1512959097, tv_nsec = 291158532}
        finish = {tv_sec = 1512959097, tv_nsec = 298360391}
        rc = 0
#15 0x00002b0be9377d2f in _cmocka_run_group_tests (group_name=0x5628a4ef407f "tests", tests=0x7ffc47d59e60, num_tests=1, group_setup=0x0, group_teardown=0x0) at ../third_party/cmocka/cmocka.c:2839
        cmtest = 0x5628a58971d0
        test_number = 1
        cm_tests = 0x5628a58971d0
        group_check_point = 0x2b0be94fe198
        group_state = 0x0
        total_tests = 1
        total_failed = 0
        total_passed = 0
        total_executed = 0
        total_errors = 0
        total_skipped = 0
        total_runtime = 0
        i = 0
        rc = 0
#16 0x00005628a4ef17db in main (argc=1, argv=0x7ffc47d59f78) at ../lib/pthreadpool/tests_cmocka.c:175
        tests = {{name = 0x5628a4ef4073 "test_create", test_func = 0x5628a4ef15bc <test_create>, setup_func = 0x5628a4ef1265 <setup_pthreadpool_tevent>, teardown_func = 0x5628a4ef133b <teardown_pthreadpool_tevent>, initial_state = 0x0}}

Thread 2 (Thread 0x2b0bea33f700 (LWP 17589)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
No locals.
#1  0x00002b0be953b649 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#2  0x00002b0be953b470 in __GI___pthread_mutex_lock (mutex=0x5628a58978a0) at ../nptl/pthread_mutex_lock.c:79
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = 4294966784
#3  0x00005628a4ef2929 in pthreadpool_server (arg=0x5628a5897890) at ../lib/pthreadpool/pthreadpool.c:566
        ret = 0
        ts = {tv_sec = 1512959098, tv_nsec = 298313430}
        job = {id = 0, fn = 0x5628a4ef3b14 <pthreadpool_tevent_job_fn>, private_data = 0x5628a5897c60}
        pool = 0x5628a5897890
        res = 0
        __PRETTY_FUNCTION__ = "pthreadpool_server"
#4  0x00002b0be93613fb in uwrap_pthread_create_start (_a=0x5628a5897980) at ../third_party/uid_wrapper/uid_wrapper.c:719
        a = 0x0
        start_routine = 0x5628a4ef263e <pthreadpool_server>
        arg = 0x5628a5897890
        id = 0x5628a5898040
#5  0x00002b0be9539184 in start_thread (arg=0x2b0bea33f700) at pthread_create.c:312
        __res = <optimized out>
        pd = 0x2b0bea33f700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {47330173908736, 7495030354223817480, 0, 0, 47330173909440, 47330173908736, 4473312489987629832, 4473306719293661960}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#6  0x00002b0be9a54ffd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
No locals.

Thread 1 (Thread 0x2b0be94fe1c0 (LWP 17587)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
No locals.
#1  0x00002b0be953b649 in _L_lock_909 () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#2  0x00002b0be953b470 in __GI___pthread_mutex_lock (mutex=0x5628a58978a0) at ../nptl/pthread_mutex_lock.c:79
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = 4294966784
#3  0x00005628a4ef2250 in pthreadpool_destroy (pool=0x5628a5897890) at ../lib/pthreadpool/pthreadpool.c:360
        ret = -375558449
        ret1 = 11019
        __PRETTY_FUNCTION__ = "pthreadpool_destroy"
#4  0x00005628a4ef31bf in pthreadpool_tevent_destructor (pool=0x5628a5897860) at ../lib/pthreadpool/pthreadpool_tevent.c:111
        state = 0x5628a5897860
        next = 0x5628a5897800
        glue = 0x0
        ret = 0
#5  0x00002b0be939c6a6 in _tc_free_internal (tc=0x5628a5897800, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1078
        d = 0x5628a4ef319c <pthreadpool_tevent_destructor>
        ptr_to_free = 0x5628a5897e40
        ptr = 0x5628a5897860
#6  0x00002b0be939d8c8 in _tc_free_children_internal (tc=0x5628a58974d0, ptr=0x5628a5897530, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1593
        child = 0x5628a5897860
        new_parent = 0x0
#7  0x00002b0be939c861 in _tc_free_internal (tc=0x5628a58974d0, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1104
        ptr_to_free = 0x1000
        ptr = 0x5628a5897530
#8  0x00002b0be939d8c8 in _tc_free_children_internal (tc=0x5628a5897210, ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1593
        child = 0x5628a5897530
        new_parent = 0x0
#9  0x00002b0be939c861 in _tc_free_internal (tc=0x5628a5897210, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1104
        ptr_to_free = 0x0
        ptr = 0x5628a5897270
#10 0x00002b0be939ca2c in _talloc_free_internal (ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1174
        tc = 0x5628a5897210
#11 0x00002b0be939dce7 in _talloc_free (ptr=0x5628a5897270, location=0x5628a4ef3f20 "../lib/pthreadpool/tests_cmocka.c:60") at ../lib/talloc/talloc.c:1716
        tc = 0x5628a5897210
#12 0x00005628a4ef136c in teardown_pthreadpool_tevent (state=0x5628a58971e0) at ../lib/pthreadpool/tests_cmocka.c:60
        t = 0x5628a5897270
#13 0x00002b0be93776e1 in cmocka_run_one_test_or_fixture (function_name=0x5628a4ef4073 "test_create", test_func=0x0, setup_func=0x0, teardown_func=0x5628a4ef133b <teardown_pthreadpool_tevent>, state=0x5628a58971e0, heap_check_point=0x2b0be94fe198) at ../third_party/cmocka/cmocka.c:2628
        check_point = 0x2b0be94fe198
        handle_exceptions = 1
        current_state = 0x0
        rc = 0
#14 0x00002b0be9377a0d in cmocka_run_one_tests (test_state=0x5628a58971d0) at ../third_party/cmocka/cmocka.c:2752
        start = {tv_sec = 1512959097, tv_nsec = 291158532}
        finish = {tv_sec = 1512959097, tv_nsec = 298360391}
        rc = 0
#15 0x00002b0be9377d2f in _cmocka_run_group_tests (group_name=0x5628a4ef407f "tests", tests=0x7ffc47d59e60, num_tests=1, group_setup=0x0, group_teardown=0x0) at ../third_party/cmocka/cmocka.c:2839
        cmtest = 0x5628a58971d0
        test_number = 1
        cm_tests = 0x5628a58971d0
        group_check_point = 0x2b0be94fe198
        group_state = 0x0
        total_tests = 1
        total_failed = 0
        total_passed = 0
        total_executed = 0
        total_errors = 0
        total_skipped = 0
        total_runtime = 0
        i = 0
        rc = 0
#16 0x00005628a4ef17db in main (argc=1, argv=0x7ffc47d59f78) at ../lib/pthreadpool/tests_cmocka.c:175
        tests = {{name = 0x5628a4ef4073 "test_create", test_func = 0x5628a4ef15bc <test_create>, setup_func = 0x5628a4ef1265 <setup_pthreadpool_tevent>, teardown_func = 0x5628a4ef133b <teardown_pthreadpool_tevent>, initial_state = 0x0}}
No locals.
A debugging session is active.

	Inferior 1 [process 17587] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20171212/e83dc614/signature.sig>


More information about the samba-technical mailing list