Re: Bug with GIN index over JSONB data: "ERROR: buffer 10112 is not owned by resource owner"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug with GIN index over JSONB data: "ERROR: buffer 10112 is not owned by resource owner"
Date: 2023-11-10 04:31:02
Message-ID: 1303019.1699590662@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jeff Janes <jeff(dot)janes(at)gmail(dot)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

Attachment Content-Type Size
cloud_init_gin_bug text/x-shellscript 556 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message rh 2023-11-10 08:02:14 Issues Encountered with PostgreSQL 16.1 RPM on EL8/EL9
Previous Message Junwang Zhao 2023-11-10 03:42:08 Re: Bug with GIN index over JSONB data: "ERROR: buffer 10112 is not owned by resource owner"