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 1mKiq2-0004o0-N1 for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 15:04:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKiq1-0007x3-IL for pgsql-general@arkaria.postgresql.org; Mon, 30 Aug 2021 15:04:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKiq1-0007wt-3A for pgsql-general@lists.postgresql.org; Mon, 30 Aug 2021 15:04:41 +0000 Received: from mail-qk1-x72c.google.com ([2607:f8b0:4864:20::72c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mKipx-00076n-Cn for pgsql-general@postgresql.org; Mon, 30 Aug 2021 15:04:40 +0000 Received: by mail-qk1-x72c.google.com with SMTP id p4so9640753qki.3 for ; Mon, 30 Aug 2021 08:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; h=to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=P87GSM/bh2TkKyUYVu604FootE478u9dSmlXPnnhd6M=; b=a6lLQudNFoAd8Vs7IBhN4Zpxht3e3Ek+PS5AzUcNeDb/rneVaOj9r2gzUzorhPbiTX bvTXxOwIaPdGdlvKGFtUSJG2xBlSJ+aK8/idMuaihVAuTpYHW1QF9SazmfeliBC/WSTV 2WSoBcExL5xA9zjL5ijjsGJs2+FL8V3wLHLGb/IB994vUo1AyDttRfh9XraRrNaEerUn ZsieMbViu/rk9YVCsuHYk96a1K0dH0CtlkNtZiLG/bUU524qChbeG5flx6oLOSFlthqz tdiHyVHJDDLLwkAPFGTxQ1zJ8LppLynJzcM890oeANEUwK4Xdc1uBiz8iufpsjPKMNN7 dE4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=P87GSM/bh2TkKyUYVu604FootE478u9dSmlXPnnhd6M=; b=VLJjHd0Nft9J7j7oAcouoG4ifXSyCN8rvVQm+7YlGIEcUGfBXKDIfw8WLYZq/yC/gG aqDg6tBEaL1lHCPsYyGd4MohAy+UI7Go3MYUJMkKlaJrDeztDDj6YjkB5ZviBjSqgY1G R5odw3QtiuuiupLHFtkAaeuUls0X1SW/n0x3nheOKofxk4XAYpqk7o9DbVC03wT+GHHN RParlR7wSZ0eE3HI79yIHDkNz1+hI/vQQKtAdIPk08VANPV+qyN0c+8scAWcCx7Z9Obp EAfmd4vuiskEz6v57gqFAgSPifvKB8mwpkR5MSwg+p0EdRn8COiSGjyhuJ9R5kC6dYJ+ 40RA== X-Gm-Message-State: AOAM531YKBehalZc3Upgs3nXAvldsn6Gy5+N3NqwT8slJwOeG7xOoXK5 SLphUcSaescOLDOIfAMEhD+HarSh4e+ukDqdBw3lRb7F3NXMUf5zoUdngRnSJxIoa49Lx7Bg55+ ubbP2ZqvVaMgOZQvW1LcWZD99KQ6JcTOpMeLRDoWzALce00H5oqter9pm5qmwozF4Eyrpf3lK2k Fx X-Google-Smtp-Source: ABdhPJyT8PBCSj366FYuw5jZ6ngt7rdVk82XgLyKwTk6Ud+YgoDyMqOr/6hl7mgYtQHAG5zivZnz3g== X-Received: by 2002:a37:91c1:: with SMTP id t184mr22911059qkd.129.1630335875153; Mon, 30 Aug 2021 08:04:35 -0700 (PDT) Received: from [192.168.4.41] (072-017-018-098.res.spectrum.com. [72.17.18.98]) by smtp.gmail.com with ESMTPSA id u27sm11508884qku.9.2021.08.30.08.04.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Aug 2021 08:04:34 -0700 (PDT) To: depesz@depesz.com, Vijaykumar Jain Cc: pgsql-general mailing list References: <20210830134510.GA14443@depesz.com> <20210830143621.GA23857@depesz.com> From: Joe Conway Subject: Re: Pg stuck at 100% cpu, for multiple days Message-ID: Date: Mon, 30 Aug 2021 11:04:33 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210830143621.GA23857@depesz.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/30/21 10:36 AM, hubert depesz lubaczewski > Anyway - it's 12.6 on aarm64. Couple of days there was replication > slot started, and now it seems to be stuck. > #0 hash_seq_search (status=status@entry=0xffffdd90f380) at ./build/../src/backend/utils/hash/dynahash.c:1448 > #1 0x0000aaaac3042060 in RelfilenodeMapInvalidateCallback (arg=, relid=105496194) at ./build/../src/backend/utils/cache/relfilenodemap.c:64 > #2 0x0000aaaac3033aa4 in LocalExecuteInvalidationMessage (msg=0xffff9b66eec8) at ./build/../src/backend/utils/cache/inval.c:595 > #3 0x0000aaaac2ec8274 in ReorderBufferExecuteInvalidations (rb=0xaaaac326bb00 , txn=0xaaaac326b998 , txn=0xaaaac326b998 ) at ./build/../src/backend/replication/logical/reorderbuffer.c:2149 > #4 ReorderBufferCommit (rb=0xaaaac326bb00 , xid=xid@entry=2668396569, commit_lsn=187650393290540, end_lsn=, commit_time=commit_time@entry=683222349268077, origin_id=origin_id@entry=0, origin_lsn=origin_lsn@entry=0) at ./build/../src/backend/replication/logical/reorderbuffer.c:1770 > #5 0x0000aaaac2ebd314 in DecodeCommit (xid=2668396569, parsed=0xffffdd90f7e0, buf=0xffffdd90f960, ctx=0xaaaaf5d396a0) at ./build/../src/backend/replication/logical/decode.c:640 > #6 DecodeXactOp (ctx=ctx@entry=0xaaaaf5d396a0, buf=0xffffdd90f960, buf@entry=0xffffdd90f9c0) at ./build/../src/backend/replication/logical/decode.c:248 > #7 0x0000aaaac2ebd42c in LogicalDecodingProcessRecord (ctx=0xaaaaf5d396a0, record=0xaaaaf5d39938) at ./build/../src/backend/replication/logical/decode.c:117 > #8 0x0000aaaac2ecfdfc in XLogSendLogical () at ./build/../src/backend/replication/walsender.c:2840 > #9 0x0000aaaac2ed2228 in WalSndLoop (send_data=send_data@entry=0xaaaac2ecfd98 ) at ./build/../src/backend/replication/walsender.c:2189 > #10 0x0000aaaac2ed2efc in StartLogicalReplication (cmd=0xaaaaf5d175a8) at ./build/../src/backend/replication/walsender.c:1133 > #11 exec_replication_command (cmd_string=cmd_string@entry=0xaaaaf5c0eb00 "START_REPLICATION SLOT cdc LOGICAL 1A2D/4B3640 (\"proto_version\" '1', \"publication_names\" 'cdc')") at ./build/../src/backend/replication/walsender.c:1549 > #12 0x0000aaaac2f258a4 in PostgresMain (argc=, argv=argv@entry=0xaaaaf5c78cd8, dbname=, username=) at ./build/../src/backend/tcop/postgres.c:4257 > #13 0x0000aaaac2eac338 in BackendRun (port=0xaaaaf5c68070, port=0xaaaaf5c68070) at ./build/../src/backend/postmaster/postmaster.c:4484 > #14 BackendStartup (port=0xaaaaf5c68070) at ./build/../src/backend/postmaster/postmaster.c:4167 > #15 ServerLoop () at ./build/../src/backend/postmaster/postmaster.c:1725 > #16 0x0000aaaac2ead364 in PostmasterMain (argc=, argv=) at ./build/../src/backend/postmaster/postmaster.c:1398 > #17 0x0000aaaac2c3ca5c in main (argc=5, argv=0xaaaaf5c07720) at ./build/../src/backend/main/main.c:228 > > The thing is - I can't close it with pg_terminate_backend(), and I'd > rather not kill -9, as it will, I think, close all other connections, > and this is prod server. > still makes me ask: why does Pg end up in such place,> where it > doesn't do any syscalls, doesn't accept pg_terminate_backend(), and > is using 100% of cpu? src/backend/utils/hash/dynahash.c:1448 is in the middle of a while loop, which is apparently not exiting. There is no check for interrupts in there and it is a fairly tight loop which would explain both symptoms. As to how it got that way, I have to assume data corruption or a bug of some sort. I would repost the details to hackers for better visibility. Joe -- Crunchy Data - http://crunchydata.com PostgreSQL Support for Secure Enterprises Consulting, Training, & Open Source Development