Re: process deadlocking on its own transactionid? - Mailing list pgsql-general

From Jeff Janes
Subject Re: process deadlocking on its own transactionid?
Date
Msg-id CAMkU=1y0th7v_ExyuujejKDeehV3deYJLJ0CLqx422GKJbUQrg@mail.gmail.com
Whole thread Raw
In response to process deadlocking on its own transactionid?  (Kevin Goess <kgoess@bepress.com>)
Responses Re: process deadlocking on its own transactionid?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-general
On Tue, Jul 23, 2013 at 12:54 PM, Kevin Goess <kgoess@bepress.com> wrote:
> We're seeing a problem with some of our processes hanging on locks.  The
> select below makes it look like it's *waiting* for a ShareLock on
> transactionid, but it *has* an ExclusiveLock on the same value in
> virtualxid.

It has an ExclusiveLock on itself, but that is independent of the
ShareLock it is waiting for.

The transaction it is waiting for is in the transactionid column,
which is not in your select list.  The virtualxid column seems pretty
useless to me, I don't really know why it is there.  Also, since you
are filtering for only the blocked pid, you will not see the blocking
pid in your results, which is probably what you really want to see.

> That makes it look like the process has deadlocked on its own transactionid.
> Or are we reading the results of this query wrong, and this is expected
> behavior, and our problem lies elsewhere?

You are reading the results wrong, which is very easy to do.

For this type of lock, you need to join the table to itself on the
transactionid column.

http://wiki.postgresql.org/wiki/Lock_Monitoring

Cheers,

Jeff


pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: [HACKERS] maintenance_work_mem and CREATE INDEX time
Next
From: Alvaro Herrera
Date:
Subject: Re: process deadlocking on its own transactionid?