From: Jaime Casanova <jcasanov@systemguards.com.ec>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: andres@anarazel.de
Cc: pgsql-hackers@postgresql.org
Subject: Re: START_REPLICATION SLOT causing a crash in an assert build
Date: Thu, 15 Sep 2022 11:15:12 -0500
Message-ID: <YyNPkABHU5uWz3NS@ahch-to> (raw)
In-Reply-To: <20220915.173011.1996796030245946057.horikyota.ntt@gmail.com>
References: <20220913.184845.2130916662920954058.horikyota.ntt@gmail.com>
<YyFFhixwFK2jk6zW@ahch-to>
<YyLFh6IL8aRzfpRF@ahch-to>
<20220915.173011.1996796030245946057.horikyota.ntt@gmail.com>
On Thu, Sep 15, 2022 at 05:30:11PM +0900, Kyotaro Horiguchi wrote:
> At Thu, 15 Sep 2022 01:26:15 -0500, Jaime Casanova <jcasanov@systemguards.com.ec> wrote in
> > On Tue, Sep 13, 2022 at 10:07:50PM -0500, Jaime Casanova wrote:
> > > On Tue, Sep 13, 2022 at 06:48:45PM +0900, Kyotaro Horiguchi wrote:
> > > >
> > > > Another measure would be to add the region to wipe-out on reset to
> > > > PgStat_KindInfo, but it seems too much.. (attached)
> > > >
> > >
> > > This patch solves the problem, i didn't like the other solution because
> > > as you say it partly nullify the protection of the assertion.
> > >
> >
> > I talked too fast, while it solves the immediate problem the patch as is
> > causes other crashes.
>
> Where did the crash happen? Is it a bug introduced by it? Or does it
> root to other cause?
>
Just compile and run the installcheck tests.
It fails at ./src/backend/utils/activity/pgstat_shmem.c:530 inside
pgstat_release_entry_ref() because it expects a "deadbeef", it seems to
be a magic variable but cannot find what its use is.
Attached a backtrace.
--
Jaime Casanova
Director de Servicios Profesionales
SystemGuards - Consultores de PostgreSQL
Attachments:gdb.txt (text/plain, 3.9K) download
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
set = {__val = {4194304, 140727848465760, 2, 6, 6808139, 94494822015184,
4611686018427388799, 139771048516262, 0, 281470681751456, 0, 0, 0, 0, 0, 0}}
pid = <optimized out>
tid = <optimized out>
ret = <optimized out>
#1 0x00007f1efb762535 in __GI_abort () at abort.c:79
save_stage = 1
act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {
0, 0, 0, 0, 0, 139771046014965, 2, 3559591060477507152, 7018350264137834804,
94494822015184, 7003716880224747600, 0, 9726297134600432896, 140727848466000, 0,
140727848466864}}, sa_flags = 1246535888, sa_restorer = 0x0}
sigs = {__val = {32, 0 <repeats 15 times>}}
#2 0x000055f14ab8e280 in ExceptionalCondition (
conditionName=0x55f14ad70420 "entry_ref->shared_stats->magic == 0xdeadbeef",
errorType=0x55f14ad70073 "FailedAssertion", fileName=0x55f14ad702da "pgstat_shmem.c",
lineNumber=530) at assert.c:69
No locals.
#3 0x000055f14aa15a1e in pgstat_release_entry_ref (key=..., entry_ref=0x55f14bf71098,
discard_pending=false) at pgstat_shmem.c:530
__func__ = "pgstat_release_entry_ref"
#4 0x000055f14aa15f68 in pgstat_release_matching_entry_refs (discard_pending=false, match=0x0,
match_data=0) at pgstat_shmem.c:699
i = {cur = 255, end = 1, done = false}
ent = 0x55f14bf450f0
#5 0x000055f14aa15fc0 in pgstat_release_all_entry_refs (discard_pending=false)
at pgstat_shmem.c:715
No locals.
#6 0x000055f14aa15203 in pgstat_detach_shmem () at pgstat_shmem.c:238
No locals.
#7 0x000055f14aa0de82 in pgstat_shutdown_hook (code=0, arg=0) at pgstat.c:520
No locals.
#8 0x000055f14a9b2b27 in shmem_exit (code=0) at ipc.c:239
__func__ = "shmem_exit"
#9 0x000055f14a9b29df in proc_exit_prepare (code=0) at ipc.c:194
__func__ = "proc_exit_prepare"
#10 0x000055f14a9b2930 in proc_exit (code=0) at ipc.c:107
__func__ = "proc_exit"
#11 0x000055f14a9ed1a0 in PostgresMain (dbname=0x55f14bed0e90 "regression",
username=0x55f14bed0e68 "jcasanov") at postgres.c:4795
firstchar = 88
input_message = {data = 0x55f14bea4900 "", len = 0, maxlen = 1024, cursor = 0}
local_sigjmp_buf = {{__jmpbuf = {0, -2769250407385151644, 94494822015184,
140727848468560, 0, 0, -2769250407297071260, -8248146431642187932},
__mask_was_saved = 1, __saved_mask = {__val = {4194304, 8534995794563506275, 15679,
15680, 979, 18446744073709551536, 0, 0, 139771044971635, 3904, 0,
140727848467536, 94494822015184, 140727848468560, 94494829323263, 15616}}}}
send_ready_for_query = false
idle_in_transaction_timeout_enabled = false
idle_session_timeout_enabled = false
__func__ = "PostgresMain"
#12 0x000055f14a924a1d in BackendRun (port=0x55f14becad20) at postmaster.c:4504
No locals.
#13 0x000055f14a924369 in BackendStartup (port=0x55f14becad20) at postmaster.c:4232
bn = 0x55f14bec7e80
pid = 0
__func__ = "BackendStartup"
#14 0x000055f14a9207ae in ServerLoop () at postmaster.c:1806
port = 0x55f14becad20
i = 2
rmask = {fds_bits = {128, 0 <repeats 15 times>}}
selres = 1
now = 1663253503
readmask = {fds_bits = {224, 0 <repeats 15 times>}}
nSockets = 8
last_lockfile_recheck_time = 1663253479
last_touch_time = 1663253239
__func__ = "ServerLoop"
#15 0x000055f14a91fffd in PostmasterMain (argc=5, argv=0x55f14be9dec0) at postmaster.c:1478
opt = -1
status = 0
userDoption = 0x55f14bec1900 "data1"
listen_addr_saved = true
i = 64
output_config_variable = 0x0
__func__ = "PostmasterMain"
#16 0x000055f14a81f3fc in main (argc=5, argv=0x55f14be9dec0) at main.c:202
do_check_root = true
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-hackers@postgresql.org
Cc: jcasanov@systemguards.com.ec, horikyota.ntt@gmail.com, andres@anarazel.de
Subject: Re: START_REPLICATION SLOT causing a crash in an assert build
In-Reply-To: <YyNPkABHU5uWz3NS@ahch-to>
References: <20220913.184845.2130916662920954058.horikyota.ntt@gmail.com> <YyFFhixwFK2jk6zW@ahch-to> <YyLFh6IL8aRzfpRF@ahch-to> <20220915.173011.1996796030245946057.horikyota.ntt@gmail.com> <YyNPkABHU5uWz3NS@ahch-to>
* 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