pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: exclusion@gmail.com
Subject: BUG #17368: Assert failed in GetSafeSnapshot() for SERIALIZABLE READ ONLY DEFERRABLE transaction
Date: Sat, 15 Jan 2022 08:00:01 +0000
Message-ID: <17368-98a4f99e8e4b4402@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17368
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 14.1
Operating system:   Ubuntu 20.04
Description:        

The isolation test "read-only-anomaly-3" modified as follows:
setup
{
	CREATE TABLE bank_account (id TEXT PRIMARY KEY, balance DECIMAL NOT
NULL);
	INSERT INTO bank_account (id, balance) VALUES ('X', 0), ('Y', 0);
}

teardown
{
	DROP TABLE bank_account;
}

session s1
setup 		{ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step s1ry	{ SELECT balance FROM bank_account WHERE id = 'Y'; }
step s1wy	{ UPDATE bank_account SET balance = 20 WHERE id = 'Y'; }
step s1c 	{ COMMIT; }

session s2
setup		{ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step s2rx	{ SELECT balance FROM bank_account WHERE id = 'X'; }
step s2ry	{ SELECT balance FROM bank_account WHERE id = 'Y'; }
step s2wx	{ UPDATE bank_account SET balance = -11 WHERE id = 'X'; }
step s2c	{ COMMIT; }

session s3
setup		{ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY
DEFERRABLE; }
step s3r	{ SELECT id, balance FROM bank_account WHERE id IN ('X', 'Y') ORDER
BY id; }
step s3c	{ COMMIT; }

session s4
setup		{ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step s4to	{ SET lock_timeout = '10ms' }
step s4wx	{ UPDATE bank_account SET balance = -11 WHERE id = 'X'; }
step s4c	{ COMMIT; }

permutation s2rx s2ry s1ry s1wy s1c s3r s2wx s2c s3c
permutation s2ry s1wy s1c s2wx s4to s4wx s4c s3r s2c s3c

causes an assertion failure with the following stacktrace:
Core was generated by `postgres: law isolation_regression [local] SELECT    
                        '.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f53a8a7c859 in __GI_abort () at abort.c:79
#2  0x000055edb1e89381 in ExceptionalCondition (conditionName=0x55edb2832980
"SxactIsROSafe(MySerializableXact)", 
    errorType=0x55edb2831da0 "FailedAssertion", fileName=0x55edb2831d60
"predicate.c", lineNumber=1612) at assert.c:69
#3  0x000055edb1714442 in GetSafeSnapshot (origSnapshot=0x55edb6ac6e40
<CurrentSnapshotData>) at predicate.c:1612
#4  0x000055edb1714b91 in GetSerializableTransactionSnapshot
(snapshot=0x55edb6ac6e40 <CurrentSnapshotData>)
    at predicate.c:1703
#5  0x000055edb201d623 in GetTransactionSnapshot () at snapmgr.c:291
#6  0x000055edb17613b5 in exec_simple_query (
    query_string=0x625000005220 "SELECT id, balance FROM bank_account WHERE
id IN ('X', 'Y') ORDER BY id;")
    at postgres.c:1103
#7  0x000055edb176ea2e in PostgresMain (argc=1, argv=0x7ffdfa7290d0,
dbname=<optimized out>, 
    username=0x629000011258 "law") at postgres.c:4486
#8  0x000055edb13ea951 in BackendRun (port=0x615000004900) at
postmaster.c:4530
#9  0x000055edb13e9142 in BackendStartup (port=0x615000004900) at
postmaster.c:4252
#10 0x000055edb13df0a3 in ServerLoop () at postmaster.c:1745
#11 0x000055edb13dcf20 in PostmasterMain (argc=8, argv=0x607000000170) at
postmaster.c:1417
#12 0x000055edb0f075c3 in main (argc=8, argv=0x607000000170) at main.c:209



view thread (12+ messages)  latest in thread

Message-ID: <17368-98a4f99e8e4b4402@postgresql.org>
Permalink:  ../17368-98a4f99e8e4b4402@postgresql.org/
Also on:    postgresql.org/message-id/17368-98a4f99e8e4b4402@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, exclusion@gmail.com
  Subject: Re: BUG #17368: Assert failed in GetSafeSnapshot() for SERIALIZABLE READ ONLY DEFERRABLE transaction
  In-Reply-To: <17368-98a4f99e8e4b4402@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox