BUG #17116: Assert failed in SerialSetActiveSerXmin() on commit of parallelized serializable transaction

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #17116: Assert failed in SerialSetActiveSerXmin() on commit of parallelized serializable transaction
Date: 2021-07-20 21:00:01
Message-ID: 17116-d6ca217acc180e30@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: 17116
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)com
PostgreSQL version: 13.3
Operating system: Ubuntu 20.04
Description:

The isolation test "serializable-parallel-2" modified as follows:
# Exercise the case where a read-only serializable transaction has
# SXACT_FLAG_RO_SAFE set in a parallel query.

setup
{
CREATE TABLE foo AS SELECT generate_series(1, 10)::int a;
ALTER TABLE foo SET (parallel_workers = 2);
}

teardown
{
DROP TABLE foo;
}

session s1
setup { BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step s1r { SELECT * FROM foo; }
step s1c { COMMIT; }

session s2
setup {
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY;
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
}
step s2r1 { SELECT * FROM foo; }
step s2r2 { SELECT * FROM foo; }
step s2c { COMMIT; }

session s3
setup { BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step s3r { SELECT * FROM foo; }
step s3c { COMMIT; }

session s4
setup {
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY;
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
}
step s4r1 { SELECT * FROM foo; }
step s4r2 { SELECT * FROM foo; }
step s4c { COMMIT; }

permutation s1r s3r s2r1 s4r1 s1c s2r2 s3c s4r2 s4c s2c

leads to a failed assertion with the following stacktrace:
Core was generated by `postgres: law isolation_regression [local] COMMIT
'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig(at)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(at)entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f21de1dd859 in __GI_abort () at abort.c:79
#2 0x0000555e1740b1ac in ExceptionalCondition (
conditionName=conditionName(at)entry=0x555e17581ce8
"!TransactionIdIsValid(serialControl->tailXid) || TransactionIdFollows(xid,
serialControl->tailXid)", errorType=errorType(at)entry=0x555e17466028
"FailedAssertion",
fileName=fileName(at)entry=0x555e17581789 "predicate.c",
lineNumber=lineNumber(at)entry=1056) at assert.c:67
#3 0x0000555e172d3c5c in SerialSetActiveSerXmin (xid=6187) at
predicate.c:1056
#4 0x0000555e172d3ecf in SetNewSxactGlobalXmin () at predicate.c:3309
#5 0x0000555e172d811c in ReleasePredicateLocks (isCommit=false,
isCommit(at)entry=true,
isReadOnlySafe=isReadOnlySafe(at)entry=false) at predicate.c:3697
#6 0x0000555e1743fbb0 in ResourceOwnerReleaseInternal (owner=<optimized
out>,
phase=phase(at)entry=RESOURCE_RELEASE_LOCKS, isCommit=isCommit(at)entry=true,
isTopLevel=isTopLevel(at)entry=true)
at resowner.c:569
#7 0x0000555e17440166 in ResourceOwnerRelease (owner=<optimized out>,
phase=phase(at)entry=RESOURCE_RELEASE_LOCKS,
isCommit=isCommit(at)entry=true, isTopLevel=isTopLevel(at)entry=true) at
resowner.c:484
#8 0x0000555e1700a156 in CommitTransaction () at xact.c:2227
#9 0x0000555e1700af28 in CommitTransactionCommand () at xact.c:2974
#10 0x0000555e172e319d in finish_xact_command () at postgres.c:2662
#11 0x0000555e172e5972 in exec_simple_query
(query_string=query_string(at)entry=0x555e18e17350 "COMMIT;")
at postgres.c:1264
#12 0x0000555e172e7b06 in PostgresMain (argc=<optimized out>,
argv=argv(at)entry=0x555e18e42ad8, dbname=<optimized out>,
username=<optimized out>) at postgres.c:4339
#13 0x0000555e17253165 in BackendRun (port=port(at)entry=0x555e18e3bb10) at
postmaster.c:4526
#14 0x0000555e172562c0 in BackendStartup (port=port(at)entry=0x555e18e3bb10) at
postmaster.c:4210
#15 0x0000555e17256507 in ServerLoop () at postmaster.c:1739
#16 0x0000555e17257a30 in PostmasterMain (argc=8, argv=<optimized out>) at
postmaster.c:1412
#17 0x0000555e171a0a4f in main (argc=8, argv=0x555e18e119e0) at main.c:210

(Discovered by running multiple installcheck-world's in parallel.)
Reproduced on REL_12_STABLE..master. It looks like the offending commit is
47a338cf.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2021-07-20 21:49:36 Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
Previous Message Andrey Borodin 2021-07-20 19:38:25 Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data