我们有一些单元测试经常死锁。通过 GDB 仔细检查,发现以下情况:
线程 1:
(gdb) bt #0 0x00110424 in __kernel_vsyscall () #1 0x00c681a3 in __lll_lock_wait_private () from /lib/libc.so.6 #2 0x00bf09fb in _L_lock_515 () from /lib/libc.so.6 #3 0x00bf068c in tr_mallochook () from /lib/libc.so.6 #4 0x00bece22 in calloc () from /lib/libc.so.6 #5 0x00b5ed93 in _dl_new_object () from /lib/ld-linux.so.2 #6 0x00b5b287 in _dl_map_object_from_fd () from /lib/ld-linux.so.2 #7 0x00b5c521 in _dl_map_object () from /lib/ld-linux.so.2 #8 0x00b66f43 in dl_open_worker () from /lib/ld-linux.so.2 #9 0x00b629a6 in _dl_catch_error () from /lib/ld-linux.so.2 #10 0x00b66a06 in _dl_open () from /lib/ld-linux.so.2 #11 0x00d38c3b in dlopen_doit () from /lib/libdl.so.2 #12 0x00b629a6 in _dl_catch_error () from /lib/ld-linux.so.2 #13 0x00d3903c in _dlerror_run () from /lib/libdl.so.2 #14 0x00d38b71 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2 ...
线程 2:
#0 0x00110424 in __kernel_vsyscall () #1 0x00d4c059 in __lll_lock_wait () from /lib/libpthread.so.0 #2 0x00d4740e in _L_lock_752 () from /lib/libpthread.so.0 #3 0x00d4731a in pthread_mutex_lock () from /lib/libpthread.so.0 #4 0x00c95dd2 in _dl_addr () from /lib/libc.so.6 #5 0x00bf0425 in tr_where () from /lib/libc.so.6 #6 0x00bf06bd in tr_mallochook () from /lib/libc.so.6 #7 0x00bed01b in malloc () from /lib/libc.so.6 ....
我在互联网上进行了大量搜索,但我真的找不出我是否做错了什么,或者我是否发现了库中的一个错误。
线程 1:
(gdb) bt #0 0x00110424 in __kernel_vsyscall () #1 0x00c681a3 in __lll_lock_wait_private () from /lib/libc.so.6 #2 0x00bf09fb in _L_lock_515 () from /lib/libc.so.6 #3 0x00bf068c in tr_mallochook () from /lib/libc.so.6 #4 0x00bece22 in calloc () from /lib/libc.so.6 #5 0x00b5ed93 in _dl_new_object () from /lib/ld-linux.so.2 #6 0x00b5b287 in _dl_map_object_from_fd () from /lib/ld-linux.so.2 #7 0x00b5c521 in _dl_map_object () from /lib/ld-linux.so.2 #8 0x00b66f43 in dl_open_worker () from /lib/ld-linux.so.2 #9 0x00b629a6 in _dl_catch_error () from /lib/ld-linux.so.2 #10 0x00b66a06 in _dl_open () from /lib/ld-linux.so.2 #11 0x00d38c3b in dlopen_doit () from /lib/libdl.so.2 #12 0x00b629a6 in _dl_catch_error () from /lib/ld-linux.so.2 #13 0x00d3903c in _dlerror_run () from /lib/libdl.so.2 #14 0x00d38b71 in dlopen@@GLIBC_2.1 () from /lib/libdl.so.2 ...
线程 2:
#0 0x00110424 in __kernel_vsyscall () #1 0x00d4c059 in __lll_lock_wait () from /lib/libpthread.so.0 #2 0x00d4740e in _L_lock_752 () from /lib/libpthread.so.0 #3 0x00d4731a in pthread_mutex_lock () from /lib/libpthread.so.0 #4 0x00c95dd2 in _dl_addr () from /lib/libc.so.6 #5 0x00bf0425 in tr_where () from /lib/libc.so.6 #6 0x00bf06bd in tr_mallochook () from /lib/libc.so.6 #7 0x00bed01b in malloc () from /lib/libc.so.6 ....
我在互联网上进行了大量搜索,但我真的找不出我是否做错了什么,或者我是否发现了库中的一个错误。