Strange assertion in procarray.c

From: Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Strange assertion in procarray.c
Date: 2024-11-25 19:38:00
Message-ID: CANtu0oiTgFW47QgpTwrMOVm3Bq4N0Y5bjvTy5sP0gYWLQuVgjw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, everyone!

While working on stabilization of tests for [0] I noticed a strange assert
happens in procarray.c [1].

It looks like this:

[562801][client backend] [isolation/two-ids/s2][50/131:536136]
ERROR: could not serialize access due to read/write dependencies among
transactions
[562801][client backend] [isolation/two-ids/s2][50/131:536136]
DETAIL: Reason code: Canceled on identification as a pivot, during commit
attempt.
[562801][client backend] [isolation/two-ids/s2][50/131:536136]
HINT: The transaction might succeed if retried.
[562801][client backend] [isolation/two-ids/s2][50/131:536136]
STATEMENT: COMMIT;
[562801][client backend] [isolation/two-ids/s2][50/0:536136] ERROR:
ResourceOwnerEnlarge called after release started
[562801][client backend] [isolation/two-ids/s2][50/0:536136]
WARNING: AbortTransaction while in ABORT state
TRAP: failed Assert("TransactionIdIsValid(proc->xid)"), File:
"../src/backend/storage/ipc/procarray.c", Line: 677, PID: 562801
[562819][client backend] [pg_regress/test_parser][:0] LOG:
disconnection: session time: 0:00:00.011 user=someone
database=regression_test_parser host=[local]
postgres: someone isolation_regression [local]
COMMIT(ExceptionalCondition+0xbe)[0x55f2a101f185]
postgres: someone isolation_regression [local]
COMMIT(ProcArrayEndTransaction+0x46)[0x55f2a0ddf7b3]
postgres: someone isolation_regression [local]
COMMIT(+0x1e29b1)[0x55f2a09e59b1]
postgres: someone isolation_regression [local]
COMMIT(+0x1e347b)[0x55f2a09e647b]
postgres: someone isolation_regression [local]
COMMIT(AbortCurrentTransaction+0xe)[0x55f2a09e63a3]
postgres: someone isolation_regression [local]
COMMIT(PostgresMain+0x538)[0x55f2a0e20ff1]
postgres: someone isolation_regression [local]
COMMIT(+0x61457b)[0x55f2a0e1757b]
postgres: someone isolation_regression [local]
COMMIT(postmaster_child_launch+0x137)[0x55f2a0d295bf]
postgres: someone isolation_regression [local]
COMMIT(+0x52cff5)[0x55f2a0d2fff5]
postgres: someone isolation_regression [local]
COMMIT(+0x52a6cd)[0x55f2a0d2d6cd]
postgres: someone isolation_regression [local]
COMMIT(PostmasterMain+0x1629)[0x55f2a0d2cfae]
postgres: someone isolation_regression [local]
COMMIT(+0x404ba2)[0x55f2a0c07ba2]
/lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca)[0x7f6afbe7e1ca]

/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b)[0x7f6afbe7e28b]
postgres: someone isolation_regression [local]
COMMIT(_start+0x25)[0x55f2a08e3ab5]

I made a reproducer for that. Ignore index_concurrently_upsert - it should
fail. Also, some source files are changed - but it is only injection points.
But in several cases of "meson test --print-errorlogs --num-processes=8
--setup running" build backend crashes. I was unable to reproduce it during
"non-running" tests.

A full backend log for the crash run is attached.

There are some helpful commands to reproduce locally:

cd build
ninja && meson test --suite setup
cd ../
export
LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"
build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck
--no-instructions -A trust
echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >>
build/runningcheck/postgresql.conf

build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off'
-D build/runningcheck -l build/testrun/runningcheck.log start
cd build
meson test --print-errorlogs --num-processes=8 --setup running

Best regards,
Mikhail.

[0]: https://commitfest.postgresql.org/50/5160/
[1]:
https://github.com/postgres/postgres/blob/478846e7688c9ab73d2695a66822e9ae0574b551/src/backend/storage/ipc/procarray.c#L677

Attachment Content-Type Size
v1-0001-meson-test-print-errorlogs-num-processes-8-setup-.patch text/plain 12.5 KB
runningcheck.log application/octet-stream 1.7 MB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2024-11-25 19:51:31 Re: [PATCH] Missing Assert in the code
Previous Message Robert Haas 2024-11-25 19:33:48 Re: Changing shared_buffers without restart