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 1w7cRl-005X1V-2S for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 17:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7cRk-00BV85-0g for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Mar 2026 17:00:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7cRj-00BV7x-2t for pgsql-hackers@lists.postgresql.org; Tue, 31 Mar 2026 17:00:08 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7cRi-0000000201F-0gIX for pgsql-hackers@postgresql.org; Tue, 31 Mar 2026 17:00:07 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-43cff5dafc3so2015363f8f.1 for ; Tue, 31 Mar 2026 10:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774976405; x=1775581205; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9ObvXVij8d1L6zSEp4tUb2asjxApYveWUww4r8cBrWk=; b=TyUmGa/BQQapqNQN81btV+XtOELHgc2/0M7lZYIl2TECDccUNLBsvEO29uxP7uHSKP 5OS++0bujSmiibo8VgSrxnXvNkRBmrVSl95kl7cKiG6frHM0ARzrLNkqqHnASp5I1mSl MLzOThIl23fUSnFJ41n7rEaD8qHQVyAGZ8kdDnA/EMJfp+M05Hhi7Fm9kuO854quRnbt HFibYYsC6lCJIAuwt9ui3bl4oSdFFJiJS13oxxglrTtmGdp8AMIL+xvSFGIx2EOcQcjD 2oWkduLLKy4qsuxM4zpZKVKWp/BjOdhhkT7wZUXSKKBCW17ZENA+JgXw2ehC6IYzl2YD nWWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774976405; x=1775581205; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9ObvXVij8d1L6zSEp4tUb2asjxApYveWUww4r8cBrWk=; b=n/lISoPJij6VOs9OTnqFwnVKwxWsh36otou+2g89B7YlEiFG5xizE2SDftjDWvAH2D WOdM7K3MMBtOjWEKRz2vYI3499TcggcFJ6ByY5CjABo+Wx7CKQTzz+QKnh1AHfk75Aqe 07dzGthoARgdBh3YajSx735Hd75r9bc0SBMxaUTF/Vc57b+3Gxnx0oxT2WO/cI+T3JQZ ooIGF1Z+OSUSGGKwMFHuQBcO4ZDMAQnd9+LumXHHdWnJ+KnB6hRewvFG1ICfgw8sZd7Q 5riD4Bu6b4xjlmAw+MTH3H995+WCrBAaey3niuzhLYur2Fdn1YhovLiHngAqG2HIvSUC IPIg== X-Forwarded-Encrypted: i=1; AJvYcCUbbJAMrHEiN72OVwnLmB8f+xIKQI5IZwnc8hb5PJ+4Nu7baJCh1twZ23/7hUA1R23U6iMOy8bs9CObn1LZ@postgresql.org X-Gm-Message-State: AOJu0YwawV1w8A9Zetgq1gIW/emXGqtSOAu+K2TkbGIXV0XW/OSOeGbb m+Lz417KdDyh3Zh63G5jzzIf67ILeX6+6kqQkrWphp8JQp25CQXHzGq8 X-Gm-Gg: ATEYQzy37kp5SfTiPABDCmIg5Q5eI+Jbal/lNTWzuTjp3Ai4hdL85SunXC3a0rdpNjV 4Fu5CsuDyQkc8YNbO9TsXXuy2+06wjsaWO3hjtPwRLZ50w9UzN4RNfG9jYx2l/PWi8YuOc4tSj8 37jKU/wXHVU1J9q3krKzebOwyea7D5PRrk0L6jsHyiSoAuNT2LqtE+vSRb3B9/J6fhXvYDE6E6V HbHgaoesBxAEZa7aSSUU1CkEQqjhXYURHcxhO/jNdkP1CZFj0GwB/qX4zmbDrZj7qtU9y+j9cGz SGou9+/nJZWq3ZgIpWVTJc7ACmhMj2MustjHEAPqZxohOBo7BHFNMdVRj33t/N5iHGeDWDV45RV hC4ELLhC3RUZnRjYKMclbqt29NGgMsi66mvKtWA2mmPWkEmOmxaGfTn0NPurjZiN0dJpwUR301F ed1mKWT1wAic+xnvaoaRoAXHAVa81hWp+8iJ8= X-Received: by 2002:a05:6000:2586:b0:439:b8b2:fad0 with SMTP id ffacd0b85a97d-43d1504958fmr715308f8f.5.1774976404494; Tue, 31 Mar 2026 10:00:04 -0700 (PDT) Received: from [192.168.0.50] ([89.149.68.143]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43cf2580194sm26506130f8f.37.2026.03.31.10.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Mar 2026 10:00:02 -0700 (PDT) Message-ID: Date: Tue, 31 Mar 2026 20:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PROPOSAL] Termination of Background Workers for ALTER/DROP DATABASE To: Michael Paquier Cc: Tom Lane , =?UTF-8?B?SXdhdGEsIEF5YS/lsqnnlLAg5b2p?= , Peter Smith , =?UTF-8?B?S3Vyb2RhLCBIYXlhdG8v6buS55SwIOmavOS6ug==?= , Pavel Stehule , Chao Li , pgsql-hackers References: <1020519.1773863522@sss.pgh.pa.us> Content-Language: en-US From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 31.03.2026 13:54, Michael Paquier wrote: > On Tue, Mar 31, 2026 at 10:00:00AM +0300, Alexander Lakhin wrote: >> So the backend is not completely stuck, but CommitTransactionCommand() >> may take more than 5 seconds under some circumstances (maybe it's worth >> investigating which exactly). > One could blame slow hardware, difficult to say, and I'm puzzled by > these periodic bumps that don't seem to happen elsewhere. I managed to get the backtrace of such a sluggish backend: Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1". 0x0000003fb1f4cc26 in posix_fadvise64 () from /lib/riscv64-linux-gnu/libc.so.6   Id   Target Id                                   Frame * 1    Thread 0x3fb2a4c620 (LWP 564194) "postgres" 0x0000003fb1f4cc26 in posix_fadvise64 () from /lib/riscv64-linux-gnu/libc.so.6 #0  0x0000003fb1f4cc26 in posix_fadvise64 () from /lib/riscv64-linux-gnu/libc.so.6 #1  0x0000002abef79444 in XLogFileClose () at xlog.c:3672 #2  0x0000002abef7cc66 in XLogWrite (WriteRqst=..., tli=tli@entry=1, flexible=flexible@entry=false) at xlog.c:2356 #3  0x0000002abef7dbfc in XLogFlush (record=33561688) at xlog.c:2892 #4  0x0000002abef77976 in RecordTransactionCommit () at xact.c:1516 #5  CommitTransaction () at xact.c:2379 #6  0x0000002abef78938 in CommitTransactionCommandInternal () at xact.c:3224 #7  0x0000002abef78acc in CommitTransactionCommand () at xact.c:3185 #8  0x0000003fb2a3ed88 in initialize_worker_spi (table=0x2abf8bf358) at worker_spi.c:132 #9  worker_spi_main (main_arg=) at worker_spi.c:181 .... (Three test runs produced the same stack trace.) I think this can explain slow CommitTransactionCommand() and why it happens not every time. Regarding other animals, I guess they can experience the same bumps but not exceeding 5 seconds (50 tries). Thus, from my understanding, for the failure to happen, we need to have slow storage and initialize_worker_spi() -> CommitTransactionCommand() reaching XLogFileClose(). Best regards, Alexander