Обсуждение: WaitOnLock: error on wakeup

Поиск
Список
Период
Сортировка

WaitOnLock: error on wakeup

От
Rachit Siamwalla
Дата:
Anyone know why I could possibly get this error? This doesn't happen
deterministically.

WaitOnLock: error on wakeup - Aborting this transaction

I also got this notice:

NOTICE:  Deadlock detected -- See the lock(l) manual page 

---

Actually, what I'm looking for in this mail is a possible way for me to
deterministically reproduce this by hand, to see if I can create this
situation and then look in my code to see where I could possibly be doing
the wrong thing. I'm not using anything fancy in my queries, Just foreign
key constraints (all initially deferred), Selects, inserts, updates, views,
transactions. No explicit lock or select for updates or triggers or notifiys
or rules.

I'm using Postgres 7.0.3.

BTW, i tried searching the mailing list and turned up nothing interesting. I
didn't search super carefully, because the search site is extremely slow.

Thanx!

-rchit


Re: WaitOnLock: error on wakeup

От
Tom Lane
Дата:
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