我们有一些经常死锁的单元测试。使用 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 来自 /lib/libc.so.6 的 tr_malochook () #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 在来自 /lib/libpthread.so.0 的 pthread_mutex_lock () #4 0x00c95dd2 in _dl_addr () from /lib/libc.so.6 #5 0x00bf0425 in tr_where () from /lib/libc.so.6 #6 0x00bf06bd in tr_malchook () from /lib/libc.so.6 #7 0x00bed01b in malloc () from /lib/libc.so.6 ……
我在互联网上进行了很多搜索,但我无法确定我是否做错了什么,或者我是否在库中发现了错误。