Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whepr-000Lff-0d for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2026 02:49:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whepp-00ATzW-2P for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2026 02:49:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whepp-00ATzO-19 for pgsql-hackers@lists.postgresql.org; Thu, 09 Jul 2026 02:49:58 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whepn-00000000OH9-1Uvw for pgsql-hackers@postgresql.org; Thu, 09 Jul 2026 02:49:57 +0000 Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-92e4fd65b2bso66371485a.0 for ; Wed, 08 Jul 2026 19:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20251104.gappssmtp.com; s=20251104; t=1783565394; x=1784170194; darn=postgresql.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=LoSZLyi3ViQnheltH9vy2pzIsaeRf0es/YC0Bin05aQ=; b=r7cD+JZN8nUSAUuzKu0XNitW+5JPSGwTVKxGivaGaAn8qB3L6vfNIZYqUilFtuhVZ6 4qJ9iSjrrXy3A8kQKF6cQSU+/VxBlATsKYaHDjEXEtuCX83tD7cPpOVJAWsiOI8KRUjb KQFo9nKWB1SsJziUKV0cpbr9Otf3lvMyZuIRKpPQUWPappQ8HPA4uj05hBY1aR6NSBCn Hc+JrrHy+CalpwlDubZyuz9n17lD7fSouEDV0hpNzN4flReRFHc8rWzOwFxoLRON7eDh 3SZAf4YQ0/jfFaQ9NBmajF97F94Ue5xH/uUIINe2Aydb/7nUxMZG9B9At9wqgETCYjrI fZug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783565394; x=1784170194; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LoSZLyi3ViQnheltH9vy2pzIsaeRf0es/YC0Bin05aQ=; b=BHkPf32t2Pw6VlpSK3D/5C/vN/2t7p0rET/yiPKp/nKdxQEcnz6jtVm0d6I15FPE1D xSyB2EGxy5NrV67sJQvVEpYzDKvCFK6oTHTo/evS1xeblhyo8S9I+nW1FEo/KD2D7hNB h6qxHTrEkYDJfDApTjjkOckVGmeKVinHL2RfUUMzmMShqXsdbwXVQRjPZDot8RAMr5eq YtG4W654NAUfYX49QszJ5GRa9KA/tvWYfFOqaa3ZDGB+yOeGtHh/2qcHD8hiajm2Kzct EkAdptMpPqte8AAqhQewiwYSkD0AaaUX+6dCsIYKB3cS0dskxEEDYF59gC5KJnK1OykR hh5g== X-Forwarded-Encrypted: i=1; AHgh+Rq7wEubrW6Ikn0MWVD8aFNDW8QxeIKBPTyUR51Y5ozJzweCyxD7zC7MDOPVmF/Ugd38tLLuUdkK39Z+tdYG@postgresql.org X-Gm-Message-State: AOJu0YyKsbHaABgOJqfpU+geWkARPBLpvu7UJOsKqL82wNbK1m7gDp+y 7A10Xnu1t5+MSDagiGSE/5IW8+KYrUOy7KbaJ3qatfsE0ISD8xRgjHPM+NwM2/uhRA== X-Gm-Gg: AfdE7clGKh8RbgYi9w2q4+gjwVvbvbIj7WJpDsJGqX0K1acDz76YtbxLL1hWJONo1P3 PSvxZ48uayzrFkjYbep5k1wWsLEBbLyjhWxaWWbNVZkexqpGcAqr7Wrg2BkBLBRBeXwv+fNGko7 frw16yUh3CSEdXVG+cP1DMaSfNYN7Ag+Lg7QnZNc50uD+Xnet0lexsk3iFoNmZhY+jHSq+htXS+ BscIAhYoTMV48RaqObrH7EIpmRPks4kpOWyGZa/8s6CBBK2nCfN5WV1wsE6cU8SanQuCahTVJ5q CYxV5hidziifvx0h3m15pE8ly6hd64+WNfcEZnXQUUD40wtBh2V9lNqAP4GuRBdXsEEqBh0rUZj Jz6XMdonQJ8OFFLFJ0rn1RHeevaCAbnUOjA3JpvWXnDo9zcNh9sCesqm6YGKLn7vhUgDa7MuQRL qUdg4c1Mio0ii/hcjo9HGY+MaxaEHYqW/wfdQvLfV1xHnuaZK6PqFNRMbssIa5xlYC8GJBHkbA1 y2GonYQ50o= X-Received: by 2002:a05:620a:2987:b0:916:10f6:77c3 with SMTP id af79cd13be357-92ecf5ee484mr580472685a.28.1783565394114; Wed, 08 Jul 2026 19:49:54 -0700 (PDT) Received: from ardentperf.com (97-113-70-203.tukw.qwest.net. [97.113.70.203]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92e90c926basm1519402185a.22.2026.07.08.19.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 19:49:53 -0700 (PDT) Date: Wed, 8 Jul 2026 19:49:51 -0700 From: Jeremy Schneider To: Jakub Wartak Cc: Anthonin Bonnefoy , Srinath Reddy Sadipiralla , PostgreSQL mailing lists Subject: Re: hang during shutdown Message-ID: <20260708194951.34705f93@ardentperf.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 6 Jul 2026 14:42:10 +0200 Jakub Wartak wrote: > On Mon, Jul 6, 2026 at 8:30=E2=80=AFAM Anthonin Bonnefoy > wrote: > > > > Hi, > > > > On Sun, Jul 5, 2026 at 11:55=E2=80=AFPM Jeremy Schneider > > wrote: > > > > Did you have an active logical replication stream at the time of the > > shutdown? If so, it's very likely due to a bug in the logical > > walsender[..] >=20 > Aren't walsenders in general problematic for shutdowns? (not just > logical, of course it might be this). The PG 19 is going to have > wal_sender_shutdown_timeout, and from description it seems to match > [0] to something like that. 'netstat -ntpo' would help to see from > such hanged system (if walsenders running there at this point at all). Between log messages and wal contents, it appears PostmasterStateMachine transitioned into PM_WAIT_BACKENDS but never progressed beyond this. I don't think walsenders are involved until it transitions into PM_WAIT_XLOG_SHUTDOWN which doesn't start until after the shutdown checkpoint (which never arrived in the wal). I remain pretty stumped :) I have put some code together that can automatically capture cmdline, comm, status, wchan, io, syscall, stack and sched from /proc for every single process in the postgres namespace/container. If privs are missing (stack is probably usually blocked) then it'll still capture other files. My initial prototype does three captures, with 3 seconds in between each. This can help determine whether processes or stuck or slow. I'm still figuring out how to trigger it at the right time, because the SIGKILL was triggered by terminationGracePeriodSeconds on kubernetes. I didn't find an obvious way to just run diag at the end (I think preStop hook fires at the beginning). I'll figure something out. -Jeremy --=20 To know the thoughts and deeds that have marked man's progress is to feel the great heart throbs of humanity through the centuries; and if one does not feel in these pulsations a heavenward striving, one must indeed be deaf to the harmonies of life. Helen Keller, The Story Of My Life, 1902, 1903, 1905, introduction by Ralph Barton Perry (Garden City, NY: Doubleday & Company, 1954), p90.