BUG #17462: Invalid memory access in heapam_tuple_lock
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: anisimow.d@gmail.com
Date: 2022-04-11T07:46:41Z
Lists: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 17462
Logged by: Daniil Anisimov
Email address: anisimow.d@gmail.com
PostgreSQL version: 14.2
Operating system: Ubuntu 20.04.4 LTS
Description:
When running parallel queries using pgbench with valgrind-enabled server:
pgbench -i -s 1
pgbench -t 1000 -c 10 -j 10
I get:
==00:00:03:09.642 456530== Invalid read of size 2
==00:00:03:09.642 456530== at 0x23820E: heapam_tuple_lock
(heapam_handler.c:509)
==00:00:03:09.642 456530== by 0x41B07F: table_tuple_lock
(tableam.h:1554)
==00:00:03:09.642 456530== by 0x41B07F: ExecUpdate
(nodeModifyTable.c:1851)
==00:00:03:09.642 456530== by 0x41C7DA: ExecModifyTable
(nodeModifyTable.c:2594)
==00:00:03:09.642 456530== by 0x3EF0AE: ExecProcNodeFirst
(execProcnode.c:463)
==00:00:03:09.642 456530== by 0x3E7278: ExecProcNode (executor.h:257)
==00:00:03:09.642 456530== by 0x3E7278: ExecutePlan (execMain.c:1551)
==00:00:03:09.642 456530== by 0x3E7E90: standard_ExecutorRun
(execMain.c:361)
==00:00:03:09.642 456530== by 0x3E7F5E: ExecutorRun (execMain.c:305)
==00:00:03:09.642 456530== by 0x5A7CAD: ProcessQuery (pquery.c:160)
==00:00:03:09.642 456530== by 0x5A888B: PortalRunMulti (pquery.c:1274)
==00:00:03:09.642 456530== by 0x5A8E3C: PortalRun (pquery.c:788)
==00:00:03:09.642 456530== by 0x5A5029: exec_simple_query
(postgres.c:1214)
==00:00:03:09.642 456530== by 0x5A6FEF: PostgresMain (postgres.c:4496)
==00:00:03:09.642 456530== Address 0x6ea7f74 is in a rw- anonymous
segment
==00:00:03:09.642 456530==
{
<insert_a_suppression_name_here>
Memcheck:Addr2
fun:heapam_tuple_lock
fun:table_tuple_lock
fun:ExecUpdate
fun:ExecModifyTable
fun:ExecProcNodeFirst
fun:ExecProcNode
fun:ExecutePlan
fun:standard_ExecutorRun
fun:ExecutorRun
fun:ProcessQuery
fun:PortalRunMulti
fun:PortalRun
fun:exec_simple_query
fun:PostgresMain
}
==00:00:03:09.642 456530==
==00:00:03:09.642 456530== Exit program on first error
(--exit-on-first-error=yes)
This starts happening at commit 1e0dfd166b3fa7fc79e4fad73b6fae056bab598a
Commits
-
Prevent access to no-longer-pinned buffer in heapam_tuple_lock().
- 7b7ed046cb2a 15.0 landed
- e0ed20d0b66e 12.11 landed
- c590e514a90d 14.3 landed
- 44096c31eaf0 13.7 landed
-
Add Valgrind buffer access instrumentation.
- 1e0dfd166b3f 14.0 cited
-
tableam: Add tuple_{insert, delete, update, lock} and use.
- 5db6df0c0117 12.0 cited