BUG #4758: deadlock.c:944

Started by sergeyalmost 17 years ago2 messagesbugs
Jump to latest
#1sergey
opium@ydk.com.ua

The following bug has been logged online:

Bug reference: 4758
Logged by: sergey
Email address: opium@ydk.com.ua
PostgreSQL version: 8.4beta1
Operating system: Linux 2.6.25-gentoo-r8
Description: deadlock.c:944
Details:

i have table with 15 records

Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
y | integer |

then i run 3 followng commands in parralel:

./bin/psql billy < sql.sql

in file sql.sql only 10000 statements "UPDATE test SET y=1;"

and what i see in log:

ERROR: 40P01: deadlock detected
DETAIL: Process 10237 waits for ShareLock on transaction 165664; blocked by
process 10242.
Process 10242 waits for ShareLock on transaction 165691; blocked by
process 10237.
Process 10237: UPDATE test SET y=1;
Process 10242: UPDATE test SET y=1;
HINT: See server log for query details.
LOCATION: DeadLockReport, deadlock.c:944

approximately one message per second

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: sergey (#1)
Re: BUG #4758: deadlock.c:944

"sergey" <opium@ydk.com.ua> writes:

ERROR: 40P01: deadlock detected
DETAIL: Process 10237 waits for ShareLock on transaction 165664; blocked by
process 10242.
Process 10242 waits for ShareLock on transaction 165691; blocked by
process 10237.
Process 10237: UPDATE test SET y=1;
Process 10242: UPDATE test SET y=1;
HINT: See server log for query details.
LOCATION: DeadLockReport, deadlock.c:944

This is not a bug. Your code is trying to update the same rows in
conflicting orders.

regards, tom lane