deadlock detected, only selects (not select-for-update) - Mailing list pgsql-general

From Gábor Farkas
Subject deadlock detected, only selects (not select-for-update)
Date
Msg-id 471EF7E6.6020403@nekomancer.net
Whole thread Raw
Responses Re: deadlock detected, only selects (not select-for-update)  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-general
hi,

i got the following error-message:

ERROR:  deadlock detected
DETAIL:  Process 32618 waits for ShareLock on transaction 1137032034;
blocked by process 16136.
         Process 16136 waits for ShareLock on transaction 1137045910;
blocked by process 32618.

(postgres 7.4 here)

i checked the mailing-list-archives, and by such problems people always
have inserts/updates or at least select-for-updates.

the strange thing is, that the code that apparently produces this error
message does not have any of these.. it's mostly like:

(please note, that i cannot reproduce this problem, and also, i am not
logging all the sql commands. so i cannot be 100% sure that it was
caused by the following code, but from other tests, these are the
commands that are executed when the error happens)

BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
now a lot of selects, but nothing complicated, all of the form of
"SELECT x FROM y WHERE a=b", with some simple joins, and SELECT DISTINCT
and ORDER BY.
END;

can any of these commands cause the mentioned deadlock?

(of course, there are other processes that write to the database at this
time, but the one that reported the deadlock was this one)

as i said, i cannot reproduce it, so it's still possible, that when the
error happened, for some strange reason, also some other sql-commands
were executed, but i do not think so.

thanks,
gabor

pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: (Never?) Kill Postmaster?
Next
From: cluster
Date:
Subject: Selecting K random rows - efficiently!