process deadlocking on its own transactionid?

From: Kevin Goess <kgoess(at)bepress(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: process deadlocking on its own transactionid?
Date: 2013-07-23 19:54:20
Message-ID: CABZkbxgDCtUC5dS9pv-hMmj9Sc55u-LWn1wsF+LwR_tfdrinaA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

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? (Yes, the process is
doing a "select for update" on this context_objects table according to
pg_stat_activity)

production=> select locktype, database, relname, relation, virtualxid,
virtualtransaction, pid, mode, granted
from pg_locks left outer join pg_class on pg_class.oid = pg_locks.relation
where pid = 2288;
locktype | database | relname | relation | virtualxid
| virtualtransaction | pid | mode | granted
---------------+----------+----------------------+----------+--------------+--------------------+------+-----------------+---------
relation | 41194 | context_objects_pkey | 95318843 |
| 123/45694692 | 2288 | AccessShareLock | t
relation | 41194 | context_objects | 41553 |
| 123/45694692 | 2288 | RowShareLock | t
virtualxid | | | | 123/45694692
| 123/45694692 | 2288 | ExclusiveLock | t
transactionid | | | |
| 123/45694692 | 2288 | ShareLock | f
tuple | 41194 | context_objects | 41553 |
| 123/45694692 | 2288 | ExclusiveLock | t
(5 rows)
```

--
Kevin M. Goess
Software Engineer
Berkeley Electronic Press
kgoess(at)bepress(dot)com

510-665-1200 x179
www.bepress.com

bepress: sustainable scholarly publishing

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2013-07-23 20:01:51 Re: odd locking behaviour
Previous Message Jeff Janes 2013-07-23 18:20:49 Re: maintenance_work_mem and CREATE INDEX time