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 1qGfiR-0007hc-Mw for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Jul 2023 13:05:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qGfiO-0005Dc-9l for pgsql-bugs@arkaria.postgresql.org; Tue, 04 Jul 2023 13:05:08 +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 1qGfiO-0005DS-0b for pgsql-bugs@lists.postgresql.org; Tue, 04 Jul 2023 13:05:08 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qGfiJ-0029Ns-Hi for pgsql-bugs@postgresql.org; Tue, 04 Jul 2023 13:05:05 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4fb77f21c63so8675813e87.2 for ; Tue, 04 Jul 2023 06:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1688475901; x=1691067901; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1BiLW2usUrg2Frkb4bnBR6paWXQF0AQ4i8uHb0bPCFU=; b=Hcq3MFmvZb9U28kIaO0AVDLnCL6Z48y7HL+oqBm6R415y9G9ozP2BhEn0rNgpjXNFa FWmAjVJaoPR/pkY6sBWFAAYAtPasBjgEcpKzJgxg53r8VpFrJ/MUyHZYbRY3HwV69P9K Nk671WqQ1OevoxhChmgQJE8quyHToK2Gx2mwRy83GtKmOf0kWWdoX/LP2YQ7nfah8z3y tiv+fSFrk1qNW5pLVYZ8e2RplHlUdv80hu/k/pDY2AFq4eeE1MwlzJLNQxTcxeaFniSn CZBush3uwUI3rEXwq0eKo6582Ul0KdFJNSaUe/6VmURbAhVFHzFKuVl+A9h40QKLimgv plRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688475901; x=1691067901; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1BiLW2usUrg2Frkb4bnBR6paWXQF0AQ4i8uHb0bPCFU=; b=kTfwRu9niLXrQtOxWqCS5+Kt4148V2vzHjhUrgYi5plfhw6Tmf9R49YY5R4rM+EJyl WWG4O9DOlsHf0QvJoR7aAx177ycMdYIhvdxqEOBp5FJPaK2/5FyPLtUza2M/ijd6OGUF 1hMcNcCu7UBZmxsmtUPulLCAfbsaD6UDmtNJZKQphRTIChw0JakzWmSCp8buK7SvHDaY FArN0Bi6/ls9MJzv4HFgI+/5/AE9z3lNJFDdCx6cLEE3jFa+wMXPmTXU+UzsK6m5XyB4 KO69Hav2Ld04Df0+uTFAQBtfuvNmkfi0+GoP4M/pdhHoMDB4MVcmFtnjwS1DxrduQQmn TtqQ== X-Gm-Message-State: ABy/qLZ8rA9b7RMBUKNH4qKNeGAwpp0UxVBJAmMGa8aP6j84yhJCqsSY hEIS3gRO+jHVb9Mi2lhInU2/A36lnyokMl74BgQ= X-Google-Smtp-Source: APBJJlGVd80GixVcW23bD9gKfSHu16yrDcR15vEC7SZQ7YRZg9dNUC7DcYHg2ugPsp1wdao7kY3Hkw== X-Received: by 2002:a05:6512:1116:b0:4f9:dac6:2f41 with SMTP id l22-20020a056512111600b004f9dac62f41mr9963791lfg.2.1688475901218; Tue, 04 Jul 2023 06:05:01 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id t14-20020a170906948e00b009886aaeb722sm13263538ejx.137.2023.07.04.06.05.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jul 2023 06:05:00 -0700 (PDT) Message-ID: Date: Tue, 4 Jul 2023 15:04:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: Backend handling replication slot stuck using 100% cpu, unkillable Content-Language: en-US To: depesz@depesz.com Cc: pgsql-bugs mailing list References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/4/23 13:53, hubert depesz lubaczewski wrote: > On Tue, Jul 04, 2023 at 01:30:21PM +0200, Tomas Vondra wrote: >> On 7/3/23 14:58, hubert depesz lubaczewski wrote: >> So is it an infinite loop in ReorderBufferExecuteInvalidations, or is it >> just the case that there are many invalidations? I can't really deduce >> that from the backtraces. >> >> How many invalidations does the transaction have? Should be enough to >> >> print txn->ninvalidations >> >> Also, is there anything interesting about the transaction? You know the >> XID (2741814901) so maybe use pg_waldump to see what it did. > > I don't have the process anymore. Pg was restarted, and the app was > forced to not take data from this place. > OK. So the slot is still there, and we could try reading the data again (hopefully getting stuck in the same place). > I can run pg_waldump, no problem, but I'm not an expert on this. Which > wal file(s) should I try to dump? and what to look for (or should I just > provide full output of dump? > The backtrace has this: and 187650155969544 should be LSN AAAA/B4E37C08, which maps to select pg_walfile_name('AAAA/B4E37C08'); pg_walfile_name -------------------------- 000000010000AAAA000000B4 So maybe try dumping that WAL segment and see if the XID 2741814901 is there. If yes, maybe share the whole dump, it's difficult to say what to share without knowing what the transaction did. There's also the LSNs in pg_replication_slots - it might be interesting to see dump for all the WAL between restart_lsn and confirmed_flush_lsn. So like this segments between: SELECT pg_walfile_name(restart_lsn), pg_walfile_name(confirmed_flush_lsn) FROM pg_replication_slots WHERE slot_name = 'slot_name'; regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company