deadlock detected errors

From: Clarence Gardner <clarence(at)silcom(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: deadlock detected errors
Date: 2006-09-04 21:24:47
Message-ID: Pine.SUN.4.02.10609042123180.955-100000@beach.silcom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I am trying to locate the source of some deadlocks that have started
cropping up recently, with little success, and I have a question regarding
the message that accompanies them.

The message my application gets is like this:
Process 244 waits for ShareLock on transaction 39523645; blocked by
process 74242.
Process 74242 waits for ShareLock on tuple (65,2) of relation 16708 of
database
16386; blocked by process 244.

But in investigating various places in my code that could be relevant, and
executing the statements manually, my deadlock messages always look like
this:
Process 38158 waits for ShareLock on transaction 15691; blocked by
process 38160.
Process 38160 waits for ShareLock on transaction 15698; blocked by process
38158.

The difference I'm asking about is that my artificial ones always involve
waiting on a transaction, while the ones from the real application always
involve one transaction wait and one tuple wait.

The first question is, is there any significance to this difference?

If so, the second question is, what is it? :) In looking at some code in
heapam.c, I see the following comment that sorta kinda sounds like maybe
there are three parties involved, with two of them waiting on a locked
tuple?

* Acquire tuple lock to establish our priority for the tuple.
* LockTuple will release us when we are next-in-line for the tuple.

Thanks for any help,
Clarence

Responses

Browse pgsql-general by date

  From Date Subject
Next Message gustavo halperin 2006-09-04 21:54:47 Porting from ORACLE to PostgSQL
Previous Message matalab 2006-09-04 20:08:15 Problems with upgrade Postgre 8.1.2 to 8.1.4