LWLock deadlock and gdb advice - Mailing list pgsql-hackers

From Jeff Janes
Subject LWLock deadlock and gdb advice
Date
Msg-id CAMkU=1zLztROwH3B42OXSB04r9ZMeSk3658qEn4_8+b+K3E7nQ@mail.gmail.com
Whole thread Raw
Responses Re: LWLock deadlock and gdb advice  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
I have a 9.5alpha1 cluster which is locked up.  All the user back ends seem to be waiting on semop, eventually on WALInsertLockAcquire.

Is there a way to use gdb to figure out who holds the lock they are waiting for?

It is compiled with both debug and cassert.

I am hoping someone can give me recipe similar to the one for Examining backend memory use in https://wiki.postgresql.org/wiki/Developer_FAQ

example backtrace:

#0  0x0000003dcb6eaf27 in semop () from /lib64/libc.so.6
#1  0x000000000067190f in PGSemaphoreLock (sema=0x7f28a98b9468) at pg_sema.c:387
#2  0x00000000006d4b0c in LWLockAcquireCommon (l=0x7f28a0e6d600, valptr=0x7f28a0e6d618, val=0) at lwlock.c:1042
#3  LWLockAcquireWithVar (l=0x7f28a0e6d600, valptr=0x7f28a0e6d618, val=0) at lwlock.c:916
#4  0x00000000004f3c4f in WALInsertLockAcquire (rdata=0xc5c130, fpw_lsn=0) at xlog.c:1411
#5  XLogInsertRecord (rdata=0xc5c130, fpw_lsn=0) at xlog.c:948
#6  0x00000000004f7aac in XLogInsert (rmid=13 '\r', info=32 ' ') at xloginsert.c:453
#7  0x000000000047e0b0 in ginPlaceToPage (btree=0x7fffca9263e0, stack=0x2c94ff8, insertdata=<value optimized out>, updateblkno=<value optimized out>, childbuf=0, buildStats=0x0)
    at ginbtree.c:418
#8  0x000000000047f3ad in ginInsertValue (btree=0x7fffca9263e0, stack=0x2c94ff8, insertdata=0x7fffca926460, buildStats=0x0) at ginbtree.c:748
#9  0x0000000000475c8b in ginEntryInsert (ginstate=0x7fffca9267e0, attnum=29784, key=1, category=<value optimized out>, items=0x7f28a0c7b458, nitem=47, buildStats=0x0)
    at gininsert.c:234
#10 0x0000000000485ecc in ginInsertCleanup (ginstate=0x7fffca9267e0, vac_delay=<value optimized out>, stats=0x0) at ginfast.c:843
#11 0x0000000000487059 in ginHeapTupleFastInsert (ginstate=0x7fffca9267e0, collector=<value optimized out>) at ginfast.c:436
#12 0x00000000004760fa in gininsert (fcinfo=<value optimized out>) at gininsert.c:531

Cheers,

Jeff

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Bug in bttext_abbrev_convert()
Next
From: Peter Geoghegan
Date:
Subject: Re: LWLock deadlock and gdb advice