From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: Bug with GIN index over JSONB data: "ERROR: buffer 10112 is not owned by resource owner"
Date: Thu, 09 Nov 2023 23:31:02 -0500
Message-ID: <1303019.1699590662@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMkU=1yCAKtv86dMrD__Ja-7KzjE=uMeKX8y__cx5W-OEWy2ow@mail.gmail.com>
References: <CAMkU=1yCAKtv86dMrD__Ja-7KzjE=uMeKX8y__cx5W-OEWy2ow@mail.gmail.com>
Jeff Janes <jeff.janes@gmail.com> writes:
> I was looking into a possible scalability problem with GIN indexes under
> concurrent insert, but instead I found an uncharacterized bug. One of the
> processes will occasionally throw an error "ERROR: buffer 10112 is not
> owned by resource owner Portal" where the buffer number changes from run to
> run.
I am able to reproduce this in HEAD (8bfb231b4) on a not-that-big
machine (M2 Mac Mini):
pgbench: error: client 1 script 0 aborted in command 0 query 0: ERROR: buffer pin 0x1cab is not owned by resource owner Portal
pgbench: error: Run was aborted; the above results are incomplete.
FTR, I used the attached not-so-ubuntu-specific script, and a
very vanilla assert-enabled build.
However, it seems like there might be more than one bug. My first
attempt died like this after a few minutes:
TRAP: failed Assert("ref != NULL"), File: "bufmgr.c", Line: 2447, PID: 7177
0 postgres 0x0000000102caab74 ExceptionalCondition + 108
1 postgres 0x0000000102b46490 UnpinBuffer + 528
2 postgres 0x000000010282bae4 ginFinishSplit + 1700
3 postgres 0x00000001028368ac ginEntryInsert + 904
4 postgres 0x0000000102837194 gininsert + 472
5 postgres 0x00000001029bf77c ExecInsertIndexTuples + 552
6 postgres 0x00000001029ed0d4 ExecInsert + 1948
7 postgres 0x00000001029ebbfc ExecModifyTable + 1252
8 postgres 0x00000001029c0dc4 standard_ExecutorRun + 268
9 postgres 0x0000000102b86450 ProcessQuery + 160
10 postgres 0x0000000102b85afc PortalRunMulti + 396
11 postgres 0x0000000102b85478 PortalRun + 476
12 postgres 0x0000000102b8453c exec_simple_query + 1312
13 postgres 0x0000000102b82250 PostgresMain + 3452
That was while running a build of commit 9ba9c7074 from 25 October.
After updating to current HEAD (8bfb231b4), I've not yet reproduced it.
But I suspect that's just bad luck, because this doesn't look like
anything we fixed in the last couple weeks.
regards, tom lane
Attachments:cloud_init_gin_bug (text/x-shellscript, 555B) download
#!/bin/bash
dropdb test
createdb test
export PGDATABASE=test
psql -c '
create table j (id bigserial, j jsonb);
create index on j using gin (j);
alter index j_j_idx set (fastupdate = off);
'
psql -c '
alter system set synchronous_commit to off;
'
pg_ctl reload
for g in `seq 1 100`; do
for f in `seq 1 10`; do
echo "trying with $f clients"
psql -c 'truncate j'
pgbench -n -f <(echo 'insert into j (j) select jsonb_object_agg(x::text, left(md5(random()::text),5)) from generate_series(1,10) f(x);') -T 60 -c $f -j $f | grep tps
done
done
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, jeff.janes@gmail.com
Subject: Re: Bug with GIN index over JSONB data: "ERROR: buffer 10112 is not owned by resource owner"
In-Reply-To: <1303019.1699590662@sss.pgh.pa.us>
References: <CAMkU=1yCAKtv86dMrD__Ja-7KzjE=uMeKX8y__cx5W-OEWy2ow@mail.gmail.com> <1303019.1699590662@sss.pgh.pa.us>
* 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