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 1lpdKp-0005ry-RI for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jun 2021 20:55:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lpdKm-0008E5-HV for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Jun 2021 20:55:56 +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 1lpdKm-0008Dx-Ay for pgsql-bugs@lists.postgresql.org; Sat, 05 Jun 2021 20:55:56 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lpdKg-0004BL-3N for pgsql-bugs@lists.postgresql.org; Sat, 05 Jun 2021 20:55:55 +0000 Received: by mail-pj1-x1036.google.com with SMTP id mp5-20020a17090b1905b029016dd057935fso1272771pjb.5 for ; Sat, 05 Jun 2021 13:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=n/LHgKVkHtj08f5yB90ydhLe1OhWJAHAJmfPoBDWeNc=; b=KGbM45CbZMlZhPGeSjH+GFp9+T8m7pGU6znH9DENm9ws+op3KzZn3vLPSHTeAjlS2i CClj+2uuteDDPZ/w5zX6FP2ji70/nAEi+8lo7aMX9hL2J3V5Au7d/t8PlhxdydHaopd3 lD/Vcqc9Z5P6S1XqmhunCn9GGh36xy9aQP4kg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=n/LHgKVkHtj08f5yB90ydhLe1OhWJAHAJmfPoBDWeNc=; b=ZwEecOcuDbB9S9CPKvTZCWbdGcWiKVU1iv7g7ZFC1xqGL1Pon2GfYeewsZSBpCJSSF LGcgh2F7gNNaTwUIj4UayxO0Ditbo9a4jnBjsicYMmD8z4PqTfsK2wBca+icym2byAQ8 82n6/Nw7ZI8G4hp9b8B475RDdFsFUxWG4azpsVzh5EouAJZue7opvQP7GtJMt/Fwqe8C oBNXHb0rmIgE/Y7gTw58fwa8tCyKmrn1PKe06w5np/or5Ats8RCrBZXbf3vMbPYdMudD 8bJOqWNUCmP3ObPvsGXJHVrv+7CFetbC23+XB2hQ9gTOE3Qjt+Cuc0Z+jQbzMs2CoNQ4 UTrA== X-Gm-Message-State: AOAM530MRqyGmmKb2Afxsk9YIXmtTD8M1IgUUehXeOfbJEYhjFqw0eVZ KBL7AfU87Jrq1S1bnuesBWqtsw== X-Google-Smtp-Source: ABdhPJxJWbh/tkJmi+0bRlf+2DKGtHODjEeT4AqshoOq4kJK8/KnsCcOVKwLmmPq149P9gf0nYp92Q== X-Received: by 2002:a17:90a:43a6:: with SMTP id r35mr23251176pjg.222.1622926549095; Sat, 05 Jun 2021 13:55:49 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id j7sm3546232pjf.0.2021.06.05.13.55.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Jun 2021 13:55:48 -0700 (PDT) Date: Sat, 5 Jun 2021 13:55:45 -0700 From: Noah Misch To: Stepan Yankevych Cc: Stepan Yankevych , "sergii.zhuravlev@smartnet.ua" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #16961: Could not access status of transaction Message-ID: <20210605205545.GE228552@rfd.leadboat.com> References: <16961-25f29f95b3604a8a@postgresql.org> <1618416199.969761000.ago134mu@frv53.fwdcdn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 19, 2021 at 06:49:15PM +0000, Stepan Yankevych wrote: > The database was rebooted and the issue disappeared Each postmaster restart clears the LISTEN/NOTIFY queue, so that fits. > The issue happening each morning when application starts on the production DataBase during about a month. > Always the same transaction id is mentioned in the error (1954017648) > We tried to do UNLISTEN - no changes. the same issue. > LISTEN works good for any other channels. > > > Can it be related to some hanged transaction? 1954017648? (for example while some network interruption) Something like that; see below. > Is it possible to kill/clean it somehow without DB restart? Not to my knowledge. > Can it be related to some non-vacuumed system table or so? Probably not. > Command - LISTEN missed_trades_empty_instrument > > ERROR: could not access status of transaction 1954017648 > DETAIL: Could not open file "pg_xact/0747": No such file or directory. > STATEMENT: LISTEN missed_trades_empty_instrument The LISTEN/NOTIFY queue stores a transaction id for each notification (internally, each AsyncQueueEntry). I can imagine the "could not access status" happening if a sequence of events like this happened since the last postmaster restart: backend 1: LISTEN missed_trades_empty_instrument backend 2: BEGIN; NOTIFY missed_trades_empty_instrument [TransactionId N] backend 1: BEGIN backend 2: COMMIT backend 1: CREATE TEMP TABLE x (); [sets TransactionId N+K] autovacuum: freezes tuples, deletes pg_xact data covering TransactionId N backend 1: COMMIT On the other hand, if that's what happened, your report that "LISTEN works good for any other channels" surprises me. Perhaps something completely different happened on your system. We could prevent the trouble if vac_truncate_clog() had access to the oldest xid in the notification queue; it would set frozenXID to that value if frozenXID would otherwise be older.