Rachit Siamwalla <rachit@ensim.com> writes:
> Anyone know why I could possibly get this error? This doesn't happen
> deterministically.
It wouldn't, because the problem arises from the interaction of multiple
clients --- AFAIK it is not possible to get that error with only a
single client, no matter what it does.
A good bet is that your code is written to acquire the same locks in
different orders in different cases. Then you can get cases like
Client A Client B;
begin;lock table a;
... begin;... lock table b;
lock table b;-- now A is waiting for B
... lock table a; -- deadlock
B's second lock attempt will be rejected with
test71=# lock table a;
ERROR: Deadlock detected. See the lock(l) manual page for a possible cause.
> WaitOnLock: error on wakeup - Aborting this transaction
> NOTICE: Deadlock detected -- See the lock(l) manual page
Apparently you're running an older PG release; that's what the
error report used to look like.
regards, tom lane