BUG #15026: Deadlock using GIST index

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: pg2401k(at)pinkwin(dot)com
Subject: BUG #15026: Deadlock using GIST index
Date: 2018-01-24 04:47:06
Message-ID: 20180124044706.24999.1281@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15026
Logged by: Mark Scheffer
Email address: pg2401k(at)pinkwin(dot)com
PostgreSQL version: 10.1
Operating system: SLES 12 sp3
Description:

Following (fabricated) example shows there is a path in the GIST code that
leads to deadlocks:

-- Session 1:
DROP TABLE IF EXISTS locked;
CREATE TABLE locked
(
key text NOT NULL,
EXCLUDE USING gist (key WITH =)
);
BEGIN;
INSERT INTO locked(key) values('a');

-- Session 2:
INSERT INTO locked(key) values('a');
--> lock wait

-- Session 3:
INSERT INTO locked(key) values('a');
--> lock wait

-- Session 1:
ROLLBACK;
--> Session 3 generates deadlock:

ERROR: deadlock detected
DETAIL: Process 16079 waits for ShareLock on transaction 1420618256;
blocked by process 8594.
Process 8594 waits for ShareLock on transaction 1420618257; blocked by
process 16079.
HINT: See server log for query details.
CONTEXT: while checking exclusion constraint on tuple (0,2) in relation
"locked"

Note: Replacing the GIST with a unique index does not produce this error.
Note: Setting deadlock_timeout to some high value will help analysis.

Version: 10.1-9.1 from OpenSuse repository
"PostgreSQL 10.1 on x86_64-suse-linux-gnu, compiled by gcc (SUSE Linux)
4.8.5, 64-bit"

Regards,

Mark.

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-01-24 05:48:16 BUG #15027: EPEL / Potgres 95 yum repo package version conflict affecting postgis22_95
Previous Message David G. Johnston 2018-01-24 03:45:24 Re: minor annoyance - search_path not reset in/after dump/restore