From: Alexander Lakhin <exclusion@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Xuneng Zhou <xunengzhou@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: per backend WAL statistics
Date: Fri, 28 Mar 2025 21:00:00 +0200
Message-ID: <f1788cc0-253a-4a3a-aee0-1b8ab9538736@gmail.com> (raw)
In-Reply-To: <Z89-gxOVxtEP_w9d@paquier.xyz>
References: <Z8hLi1dGfPFc8AYy@ip-10-97-1-34.eu-west-3.compute.internal>
<clef2a7wqnopfjw3jl7pbn25gko6m3fk2zctmtqjgyx6a7xw5j@sujsipmj4zif>
<Z8iJUHn13NsSCYhj@ip-10-97-1-34.eu-west-3.compute.internal>
<Z8l6EMM4ImVoWRkg@ip-10-97-1-34.eu-west-3.compute.internal>
<Z8qHNelALLU6LiSy@paquier.xyz>
<Z8qvQFG/70pt33E0@ip-10-97-1-34.eu-west-3.compute.internal>
<Z8ukEg7Z3KsNfEoo@paquier.xyz>
<Z8v3YIvhNTrhzhZb@ip-10-97-1-34.eu-west-3.compute.internal>
<Z86Y7cDkebuIhsDj@paquier.xyz>
<Z87SetO+E/QOayNP@ip-10-97-1-34.eu-west-3.compute.internal>
<Z89-gxOVxtEP_w9d@paquier.xyz>
Hello Michael,
11.03.2025 02:06, Michael Paquier wrote:
> And I guess that we're OK here, so applied. That should be the last
> one.
Please try the following query:
BEGIN;
SET LOCAL stats_fetch_consistency = snapshot;
SELECT * FROM pg_stat_get_backend_wal(pg_backend_pid());
with sanitizers (or under Valgrind). When I run it, I get:
2025-03-28 18:38:08.259 UTC [3415399] LOG: statement: SELECT * FROM pg_stat_get_backend_wal(pg_backend_pid());
=================================================================
==3415399==ERROR: AddressSanitizer: heap-use-after-free on address 0x53100003c83c at pc 0x556e3d2d9967 bp 0x7ffda3cd2350
sp 0x7ffda3cd2340
READ of size 4 at 0x53100003c83c thread T0
#0 0x556e3d2d9966 in pgstat_fetch_stat_backend_by_pid .../src/backend/utils/activity/pgstat_backend.c:136
#1 0x556e3d53b671 in pg_stat_get_backend_wal .../src/backend/utils/adt/pgstatfuncs.c:1673
#2 0x556e3cb14045 in ExecMakeTableFunctionResult .../src/backend/executor/execSRF.c:234
#3 0x556e3cb6c0fd in FunctionNext .../src/backend/executor/nodeFunctionscan.c:94
#4 0x556e3cb171d2 in ExecScanFetch ../../../src/include/executor/execScan.h:126
#5 0x556e3cb171d2 in ExecScanExtended ../../../src/include/executor/execScan.h:170
#6 0x556e3cb171d2 in ExecScan .../src/backend/executor/execScan.c:59
#7 0x556e3cb6bbf7 in ExecFunctionScan .../src/backend/executor/nodeFunctionscan.c:269
#8 0x556e3cb0aba9 in ExecProcNodeFirst .../src/backend/executor/execProcnode.c:469
...
Reproduced starting from 76def4cdd.
Best regards,
Alexander Lakhin
Neon (https://neon.tech)
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: exclusion@gmail.com, michael@paquier.xyz, bertranddrouvot.pg@gmail.com, andres@anarazel.de, xunengzhou@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: per backend WAL statistics
In-Reply-To: <f1788cc0-253a-4a3a-aee0-1b8ab9538736@gmail.com>
* 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