BUG #18658: Assert in SerialAdd() due to race condition

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: andrewbille(at)gmail(dot)com
Subject: BUG #18658: Assert in SerialAdd() due to race condition
Date: 2024-10-16 15:32:03
Message-ID: 18658-7dab125ec688c70b@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: 18658
Logged by: Andrew Bille
Email address: andrewbille(at)gmail(dot)com
PostgreSQL version: 17.0
Operating system: Ubuntu 20.04
Description:

Hello!

The following script against a server (master c259b1578) compiled with
-DTEST_SUMMARIZE_SERIAL (without the define it's harder to reproduce...):

echo "CREATE TABLE t(f1 int);" | psql test

for i in seq 100; do
echo "
SET default_transaction_isolation to 'SERIALIZABLE';
SELECT 'INSERT INTO t VALUES(42);' FROM generate_series(1, 100) g
\gexec
" | psql -q test &

echo "
SET default_transaction_isolation to 'SERIALIZABLE';
SELECT 'INSERT INTO t VALUES(42);' FROM generate_series(1, 100) g
\gexec
" | psql -q test &

wait

grep 'TRAP:' server.log && break;
done

fails for me with the following stack trace:
#5 0x000055e6aaf3fef5 in ExceptionalCondition
(conditionName=conditionName(at)entry=0x55e6ab1232d1
"TransactionIdIsValid(tailXid)", fileName=fileName(at)entry=0x55e6ab1231d9
"predicate.c", lineNumber=lineNumber(at)entry=886) at assert.c:66
#6 0x000055e6aadcde64 in SerialAdd (xid=976743,
minConflictCommitSeqNo=18446744073709551615) at predicate.c:886
#7 0x000055e6aadd0877 in SummarizeOldestCommittedSxact () at
predicate.c:1521
#8 0x000055e6aadd094f in GetSerializableTransactionSnapshotInt
(snapshot=snapshot(at)entry=0x55e6ab32f3e0 <CurrentSnapshotData>,
sourcevxid=sourcevxid(at)entry=0x0, sourcepid=sourcepid(at)entry=-1) at
predicate.c:1789
#9 0x000055e6aadd2a51 in GetSerializableTransactionSnapshot
(snapshot=snapshot(at)entry=0x55e6ab32f3e0 <CurrentSnapshotData>) at
predicate.c:1693
#10 0x000055e6aaf868c4 in GetTransactionSnapshot () at snapmgr.c:257
#11 0x000055e6aade2d9a in exec_simple_query
(query_string=query_string(at)entry=0x55e6ab433fe0 "SELECT 'INSERT INTO t
VALUES(42);' FROM generate_series(1, 100) g\n ") at postgres.c:1173
#12 0x000055e6aade516f in PostgresMain (dbname=<optimized out>,
username=<optimized out>) at postgres.c:4793
#13 0x000055e6aadde301 in BackendMain (startup_data=<optimized out>,
startup_data_len=<optimized out>) at backend_startup.c:107
#14 0x000055e6aad2cbf8 in postmaster_child_launch
(child_type=child_type(at)entry=B_BACKEND,
startup_data=startup_data(at)entry=0x7ffc1ca820e4 "",
startup_data_len=startup_data_len(at)entry=4,
client_sock=client_sock(at)entry=0x7ffc1ca82120)
at launch_backend.c:274
#15 0x000055e6aad30e72 in BackendStartup
(client_sock=client_sock(at)entry=0x7ffc1ca82120) at postmaster.c:3420
#16 0x000055e6aad31092 in ServerLoop () at postmaster.c:1653
#17 0x000055e6aad324e6 in PostmasterMain (argc=argc(at)entry=3,
argv=argv(at)entry=0x55e6ab42e390) at postmaster.c:1351
#18 0x000055e6aac48bd7 in main (argc=3, argv=0x55e6ab42e390) at main.c:197

This is also reproduced on dafaa3efb
Implement genuine serializable isolation level.

...

Thanks, Andrew

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alena Rybakina 2024-10-16 16:42:52 Re: Performance Issue on Query 18 of TPC-H Benchmark
Previous Message Ba Jinsheng 2024-10-16 14:56:54 Re: Performance Issue on Query 18 of TPC-H Benchmark