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.94.2) (envelope-from ) id 1s42Ui-0005bv-52 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 May 2024 17:51:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s42Uf-00Eu6S-1A for pgsql-hackers@arkaria.postgresql.org; Mon, 06 May 2024 17:51:17 +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.94.2) (envelope-from ) id 1s42Ue-00Eu6K-Ne for pgsql-hackers@lists.postgresql.org; Mon, 06 May 2024 17:51:17 +0000 Received: from fout7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s42Ua-001sTn-VY for pgsql-hackers@lists.postgresql.org; Mon, 06 May 2024 17:51:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id D211413803A8; Mon, 6 May 2024 13:51:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 06 May 2024 13:51:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1715017870; x=1715104270; bh=t0KMJWyXmi aPwr/+sJ9KWPDSLSQjBcMpsL1rbN4xPxY=; b=sJv0zMmsbaP59bYz6L2QN3Nota 4DlYgT6Cf4vK2YQ7qU2rWqYvijZN/PwUeWfMNrgd6D97qhwt7qcJfoamCyFb3vr4 mcgzVrfRhWYfRMhsexcoHRyMnViNZQfC4kaOC2qCRHCjjGJaGiCWA30mTfK//2Sj H5gBf4IyQPPXoam4tGpXRdLlNuzauUU2/oPT6uol2t4QIxhZaFQWk8calokJLqw1 cjcwBqGCYAUR9d8AOjJh1h2cXR2CKZT1doCKr6oFu9AZLXiM/CkmtS9n3B5DKS0I 2tWusxqqPjmXjAKZTT57siZ3CxZmvUbGzs9GS6r2VRAP0V/UWn8yriFNm6KQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715017870; x=1715104270; bh=t0KMJWyXmiaPwr/+sJ9KWPDSLSQj BcMpsL1rbN4xPxY=; b=gnGthEo4u8WJ+x+AfTpZFLmYuC3LJxxGtbs1ByjkWOof qm3gkuTKZ4hTdqMY6rKkzjzzfsi1cv4IXTsEJbwiY/5CgJkgjuZQjc2DA2LUvzRk g/tJT1RRO4TOmR2cgBKyRoKNFunzoIqLUYfZMcCzZpxw68uX/iLdQxjzCUAXscZl KY9kTGTX4Gybpg5hPO19xZxr6G1TKCiqBPk+IPDn9ku4l+JMttdkS2qCblYopBrt 0zyMEO/8J/CQDFiE8730r2YHJReskkXn9i3IRHSZQu7WYm5+pG+O0a8DSSftuXOL uvoFHLMoJBUVdiugTPGZTCdr57ZNF/ef1XENqY56kw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddviedguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 May 2024 13:51:10 -0400 (EDT) Date: Mon, 6 May 2024 10:51:08 -0700 From: Andres Freund To: Justin Pryzby Cc: pgsql-hackers@lists.postgresql.org Subject: Re: backend stuck in DataFileExtend Message-ID: <20240506175108.pcre3ohvlfi2hmdu@awork3.anarazel.de> References: <20240506170413.u7rybdg7nmgrizfu@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2024-05-06 12:37:26 -0500, Justin Pryzby wrote: > On Mon, May 06, 2024 at 10:04:13AM -0700, Andres Freund wrote: > > Hi, > > > > On 2024-05-06 09:05:38 -0500, Justin Pryzby wrote: > > > In March, I noticed that a backend got stuck overnight doing: > > > > > > backend_start | 2024-03-27 22:34:12.774195-07 > > > xact_start | 2024-03-27 22:34:39.741933-07 > > > query_start | 2024-03-27 22:34:41.997276-07 > > > state_change | 2024-03-27 22:34:41.997307-07 > > > wait_event_type | IO > > > wait_event | DataFileExtend > > > state | active > > > backend_xid | 330896991 > > > backend_xmin | 330896991 > > > query_id | -3255287420265634540 > > > query | PREPARE mml_1 AS INSERT INTO child.un... > > > > > > The backend was spinning at 100% CPU: > > > > > > [pryzbyj@telsa2021 ~]$ ps -O wchan,pcpu 7881 > > > PID WCHAN %CPU S TTY TIME COMMAND > > > 7881 ? 99.4 R ? 08:14:55 postgres: telsasoft ts [local] INSERT > > > > > > This was postgres 16 STABLE compiled at 14e991db8. > > > > > > It's possible that this is a rare issue that we haven't hit before. > > > It's also possible this this is a recent regression. We previously > > > compiled at b2c9936a7 without hitting any issue (possibly by chance). > > > > > > I could neither strace the process nor attach a debugger. They got > > > stuck attaching. Maybe it's possible there's a kernel issue. This is a > > > VM running centos7 / 3.10.0-1160.49.1.el7.x86_64. > > > > > $ awk '{print $14, $15}' /proc/7881/stat # usr / sys > > > 229 3088448 > > > > > > When I tried to shut down postgres (hoping to finally be able to attach > > > a debugger), instead it got stuck: > > > > That strongly indicates either a kernel bug or storage having an issue. It > > can't be postgres' fault if an IO never completes. > > Is that for sure even though wchan=? (which I take to mean "not in a system > call"), and the process is stuck in user mode ? Postgres doesn't do anything to prevent a debugger from working, so this is just indicative that the kernel is stuck somewhere that it didn't set up information about being blocked - because it's busy doing something. > > What do /proc/$pid/stack say? > > [pryzbyj@telsasoft-centos7 ~]$ sudo cat /proc/18468/stat > 18468 (postgres) R 2274 18468 18468 0 -1 4857920 91836 0 3985 0 364 3794271 0 0 20 0 1 0 6092292660 941846528 10 18446744073709551615 4194304 12848820 140732995870240 140732995857304 139726958536394 0 4194304 19929088 536896135 0 0 0 17 3 0 0 1682 0 0 14949632 15052146 34668544 140732995874457 140732995874511 140732995874511 140732995874781 0 stack, not stat... > > > Full disclosure: the VM that hit this issue today has had storage-level > > > errors (reported here at ZZqr_GTaHyuW7fLp@pryzbyj2023), as recently as 3 > > > days ago. > > > > So indeed, my suspicion from above is confirmed. > > I'd be fine with that conclusion (as in the earlier thread), except this > has now happened on 2 different VMs, and the first one has no I/O > issues. If this were another symptom of a storage failure, and hadn't > previously happened on another VM, I wouldn't be re-reporting it. Is it the same VM hosting environment? And the same old distro? Greetings, Andres Freund