Re: LWLock deadlock and gdb advice

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LWLock deadlock and gdb advice
Date: 2015-06-30 04:52:40
Message-ID: CAA4eK1Kd5bk0XSGzcRoFpskyfBARO1nKgYQbKihAJ=b8voLYpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 30, 2015 at 6:25 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>
> On Mon, Jun 29, 2015 at 5:37 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-06-30 05:30:26 Re: drop/truncate table sucks for large values of shared buffers
Previous Message Amit Kapila 2015-06-30 04:14:51 Re: drop/truncate table sucks for large values of shared buffers