Re: LWLock deadlock and gdb advice - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: LWLock deadlock and gdb advice
Date
Msg-id CAA4eK1Kd5bk0XSGzcRoFpskyfBARO1nKgYQbKihAJ=b8voLYpw@mail.gmail.com
Whole thread Raw
In response to Re: LWLock deadlock and gdb advice  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
On Tue, Jun 30, 2015 at 6:25 AM, Peter Geoghegan <pg@heroku.com> wrote:
>
> On Mon, Jun 29, 2015 at 5:37 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> > Is there a way to use gdb to figure out who holds the lock they are waiting
> > for?
>
> Have you considered building with LWLOCK_STATS defined, and LOCK_DEBUG
> defined? That might do it.
>

If you define LOCK_DEBUG, then you can check owner of the
lock [1], which will tell you about the Exclusive owner of that lock
and can help you in debugging the problem.


[1]
#ifdef LOCK_DEBUG
struct PGPROC *owner; /* last exlusive owner of the lock */
#endif
} LWLock;


With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: drop/truncate table sucks for large values of shared buffers
Next
From: Simon Riggs
Date:
Subject: Re: drop/truncate table sucks for large values of shared buffers