是否可以使用gdb检查哪个线程阻塞pthread_cond_timedwait?

时间:2016-09-12 04:30:20

标签: multithreading mongodb assembly gdb pthreads

我们的mongodb在制作中多次挂起,在我看来有一个僵局。

使用gdb,我们可以看到大多数线程都挂在pthread_cond_timedwait。

有没有办法找出哪个线程持有锁?

(gdb) bt full
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
No locals.
#1  0x0000000000bba269 in mongo::CondVarLockGrantNotification::wait(unsigned int) ()
No symbol table info available.
#2  0x0000000000bbdd37 in mongo::LockerImpl<false>::lockComplete(mongo::ResourceId, mongo::LockMode, unsigned int, bool) ()
No symbol table info available.
#3  0x0000000000bb3ff9 in mongo::Lock::ResourceLock::lock(mongo::LockMode) ()

(gdb) info args
No symbol table info available.
(gdb) info locals
No locals.
(gdb) info registers
rax            0xfffffffffffffdfc   -516
rbx            0x7fb988055700   140434827728640
rcx            0xffffffffffffffff   -1
rdx            0x35a49  219721
rsi            0x189    393
rdi            0x636d752d4  26689884884
rbp            0x0  0x0
rsp            0x7fb988054a40   0x7fb988054a40
r8             0x636d752a8  26689884840
r9             0xffffffff   4294967295
r10            0x7fb988052990   140434827717008
r11            0x206    518
r12            0x0  0
r13            0x7fb9c9728060   140435925401696
r14            0xb9b0   47536
r15            0x7fb988055700   140434827728640
rip            0x7fb9c80a787d   0x7fb9c80a787d <clone+109>
eflags         0x206    [ PF IF ]
cs             0x33 51
ss             0x2b 43
ds             0x0  0
es             0x0  0
fs             0x0  0
gs             0x0  0

0 个答案:

没有答案