Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYrWM-0004At-D6 for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Sep 2022 16:15:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYrWL-0005KD-2f for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Sep 2022 16:15:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYrWK-0005K4-IC for pgsql-hackers@lists.postgresql.org; Thu, 15 Sep 2022 16:15:20 +0000 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oYrWH-00038T-TY for pgsql-hackers@postgresql.org; Thu, 15 Sep 2022 16:15:19 +0000 Received: by mail-qk1-x733.google.com with SMTP id 3so13203157qka.5 for ; Thu, 15 Sep 2022 09:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemguards-com-ec.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=UFVcMgLcu9rOHtWPve5VtbDObyRp6iEv0AbgD18/xVg=; b=qaOuHyt5BXnREZjohiHG0+lfAn0qi3CBLuFG06KmQMrW9FEuRcRyuoZnsWyEDAhIhQ Bhj77rELFL4xdu2l6gtjK/jDVge7gjSP/uqGvkAt++bkzmHUuULldHN7/pxJjO5JAJUH AOvNZDGskmjfu+XYY+xxFIBx4yH0jpcUCtYXuT+Adys5vpOOPg4P1Mokk3EgyA+/kUuE x6AdQD4jEOa3tmFGk2PiUM5ZRrM6KpLn4as+SGH/RObpz2Bgt25J1pBJ4/QjblZPEO7/ 2gjtHuHhwxnUOKZsz650me3LNmOaqIkVofk8BoV3AvOzBgHPmribdS2Maz066UUQwx4T +0hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=UFVcMgLcu9rOHtWPve5VtbDObyRp6iEv0AbgD18/xVg=; b=Ap8R+CLvfh6a2X8fK7w9vmjEtAyJCOf2f4jrVIrrNgDxt24zgQDA3/brbm+addyfpR 3hRnzBoA1JNw18Ggpt6vzdMCJq1hf1OeURMwEzVB/tmMkIA4WlAG1asK3uIrp7gbc0e3 +kuB/FcWziDQGGp2X8aMIWSgaAlZpnrurbvzskCEhgqh7ceHBy7PFEWvf3ieDGD6rci4 7SW7XFsavlhYVr+oHkBndplo+cl7DAtnmV6JSjiI5feKCGT/HwLvDuiL8RVNnzsdT6Wr 0Tb5Ma7bOUzZmYSk6R+QBPz9d6dcobyP45iWHrgfrBcwNsT4/pvldgDqXSVuqfAXvOjl X8jQ== X-Gm-Message-State: ACrzQf0Fh/bGMW8TcGtscgTn2kNjJrGuMiP3erFmKi9Z0cC+xNP/v2MQ U71eIrmlsnSD66tOxCMmV4oAag== X-Google-Smtp-Source: AMsMyM7t+VzeMX/NfragiWwUq0uE9cP2ANolU0RSIfahaJU+6x2GXteYWMIMvrjfJ8EOLFgu82ZNUw== X-Received: by 2002:a05:620a:158d:b0:6cd:efb1:8eb6 with SMTP id d13-20020a05620a158d00b006cdefb18eb6mr648736qkk.185.1663258516045; Thu, 15 Sep 2022 09:15:16 -0700 (PDT) Received: from ahch-to ([201.183.1.162]) by smtp.gmail.com with ESMTPSA id hf22-20020a05622a609600b0035ba90126e7sm3568528qtb.91.2022.09.15.09.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 09:15:15 -0700 (PDT) Date: Thu, 15 Sep 2022 11:15:12 -0500 From: Jaime Casanova To: Kyotaro Horiguchi Cc: andres@anarazel.de, pgsql-hackers@postgresql.org Subject: Re: START_REPLICATION SLOT causing a crash in an assert build Message-ID: References: <20220913.184845.2130916662920954058.horikyota.ntt@gmail.com> <20220915.173011.1996796030245946057.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="dk5BzKwZQcZZfrA4" Content-Disposition: inline In-Reply-To: <20220915.173011.1996796030245946057.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dk5BzKwZQcZZfrA4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 15, 2022 at 05:30:11PM +0900, Kyotaro Horiguchi wrote: > At Thu, 15 Sep 2022 01:26:15 -0500, Jaime Casanova 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 --dk5BzKwZQcZZfrA4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb.txt" #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 = tid = ret = #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 }} #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 }} selres = 1 now = 1663253503 readmask = {fds_bits = {224, 0 }} 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 --dk5BzKwZQcZZfrA4--