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 1rv6ER-009gbJ-Oc for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2024 02:01:36 +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 1rv6EQ-008GwZ-BV for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Apr 2024 02:01:34 +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.94.2) (envelope-from ) id 1rv6EQ-008Gvz-24 for pgsql-hackers@lists.postgresql.org; Fri, 12 Apr 2024 02:01:34 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rv6EL-002R2l-67 for pgsql-hackers@postgresql.org; Fri, 12 Apr 2024 02:01:32 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2a475bdd4a6so226190a91.2 for ; Thu, 11 Apr 2024 19:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712887288; x=1713492088; darn=postgresql.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=Z+PADC5lW58beF+BqiSy5+y/WCaQ29zSDUqQOYoJqGM=; b=X0JPXwqU8KwXxFwNvegliPq2R+3L0Ctc0DPtOP6jWW+UQqkel4D340S070ftAwU2g5 OyhkQEbCBUTqMGJQT7ltmBjejStZQdSXCOlmHn8vtglc3KeWJwhHFtsmS3UA+YwfH26Y rO10VAtVSyKM36GeWUjGp4hBmZmjfTzvsB+G0guYV+XA4/dLkiGtwWwDX+mxyykBlc4m xVrT774K9JaaSlacATmSTPv4AfrX0X0tU/uUYnCUBxXCOWshYtvwVq9/+fhn2D//i2Nt pPWj/21AqE9xjmbjX4J/9/He6IK37kO/GprNIFk8sb5LrTwAGoN2qrL7/8Kz9S5VjlWc hySQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712887288; x=1713492088; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Z+PADC5lW58beF+BqiSy5+y/WCaQ29zSDUqQOYoJqGM=; b=su8ZtbxLAtLaGV8uf2e3aA+QjRNZjVZiopZeS6gMcHa+Y3fkjDxehLTngYEjVWGC8D 23zF43KN9vtqKrzO89EYaH4qbnVMylBwyo32m+dEaIL/sQY6w1aQD/a7Bw9QbOZ7Zy00 /suhCKOvaNFKoTQF/TfRUB5CweQDoCOG5+oFGD8WzOBY+IdWz6eAG4Psq+Hu+F62Gwfe 9lNcuNMboKALL0HNT85uS7HHu2MSyjQqCdcWWbbRvWlVOm1w/iVpODN8SMUrFw5+wKo4 /4oUF9KpjPgZz/JLLBcG8UPZFNAeF1+Zjoqj/lr+U9yQBm6E54eIthasV0ZqbxXuKkpc epAA== X-Forwarded-Encrypted: i=1; AJvYcCUbIh0jrT2aVco2YHsQkRTxWGmYYaG28uhBSROZ18/YKDzgSct0XbWGxdmonsDYAkxosVlq1Hkd1bnCfecqkHZKwAAlcv3nZjldJSi6 X-Gm-Message-State: AOJu0Ywucmx3ubnNnjllMqRlHZnsrH9KPOBsPVVgZybY6P/UNY5XaCPC G3O6qwMpMYzvV3nqhUvU8oaVdNgrOMRQPkYf7gJUv1D4EBqTdUrk X-Google-Smtp-Source: AGHT+IF+YCtScpAaIPyjrPh/+XFD7exR3Dbmjt1kuC5lzB9huvxZXKV4hIb2zH8Hx8Oyg1T8LImvqw== X-Received: by 2002:a17:90b:46c8:b0:2a2:50ef:ece2 with SMTP id jx8-20020a17090b46c800b002a250efece2mr1232675pjb.17.1712887287962; Thu, 11 Apr 2024 19:01:27 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id gf17-20020a17090ac7d100b0029c472ec962sm3466246pjb.47.2024.04.11.19.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 19:01:27 -0700 (PDT) Date: Fri, 12 Apr 2024 11:01:24 +0900 (JST) Message-Id: <20240412.110124.977560148390249226.horikyota.ntt@gmail.com> To: michael@paquier.xyz Cc: reshkekirill@gmail.com, nathandbossart@gmail.com, antholeu@amazon.com, x4mmm@yandex-team.ru, pgsql-hackers@postgresql.org Subject: Re: Allow non-superuser to cancel superuser tasks. From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Fri, 12 Apr 2024 09:10:35 +0900, Michael Paquier wrote in > On Thu, Apr 11, 2024 at 04:55:59PM +0500, Kirill Reshke wrote: > > The test doesn't fail because pg_terminate_backend actually meets his > > point: autovac is killed. But while dying, autovac also receives > > segfault. Thats because of injections points: > > > > (gdb) bt > > #0 0x000056361c3379ea in tas (lock=0x7fbcb9632224 > access memory at address 0x7fbcb9632224>) at > > ../../../../src/include/storage/s_lock.h:228 > > #1 ConditionVariableCancelSleep () at condition_variable.c:238 ... > > #3 0x000056361c330a40 in CleanupProcSignalState (status=, arg=) at procsignal.c:240 > > #4 0x000056361c328801 in shmem_exit (code=code@entry=1) at ipc.c:276 > > #9 0x000056361c3378d7 in ConditionVariableTimedSleep > > (cv=0x7fbcb9632224, timeout=timeout@entry=-1, ... > I can see this stack trace as well. Capturing a bit more than your > own stack, this is crashing in the autovacuum worker while waiting on > a condition variable when processing a ProcessInterrupts(). > > That may point to a legit bug with condition variables in this > context, actually? From what I can see, issuing a signal on a backend > process waiting with a condition variable is able to process the > interrupt correctly. ProcSignalInit sets up CleanupProcSignalState to be called via on_shmem_exit. If the CV is allocated in a dsm segment, shmem_exit should have detached the region for the CV. CV cleanup code should be invoked via before_shmem_exit. regards. -- Kyotaro Horiguchi NTT Open Source Software Center