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 1tPmP4-00FESK-Pk for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Dec 2024 17:39:39 +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 1tPmP4-00DTGe-4n for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Dec 2024 17:39:37 +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 1tPmP3-00DTGE-Rf for pgsql-bugs@lists.postgresql.org; Mon, 23 Dec 2024 17:39:37 +0000 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tPmP1-000DNl-2k for pgsql-bugs@lists.postgresql.org; Mon, 23 Dec 2024 17:39:36 +0000 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-aaecf50578eso245411066b.2 for ; Mon, 23 Dec 2024 09:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1734975574; x=1735580374; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=KhKV76dfZ36DCfnk9HDJsElXWjuo1SL3zMionPxpU/8=; b=TwqD2Te9zqwIqJ7Dobt3GEJNqyUc7bgiIifTxx8YwSCbK5enwsxvnwG7lpP7Iakjh7 YH+wOMqCSIvs+0wFC0jmKt9yoAPVYxC9e6IFpNxO7JE8/AkKtauIuvfTnnWbc1Fs7Tfr w15cmeP+MFkZBl2fhKanQV9yn9eSzwPV5rUEQDeZKFbQGnTzYaEeZnqXxSOmjRo8uEMd UBAlhqWDMIggnV1qidxJt4JC18lPyKlM11TTkakNAr9WplK3tVpO460BHBBNRWbJpv9D NY+ngl++ziBjkDtw0ZCRrMBWR0P/ssq6bVfQpUQj9pMRIfzR105/yEJKQm3wjaM3f3J7 2O6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734975574; x=1735580374; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KhKV76dfZ36DCfnk9HDJsElXWjuo1SL3zMionPxpU/8=; b=qYCmeHYr9+tyh0IhJJM25Ssxbxj98grERo23kYtQh8T95FlZQI7WHgPD936td5IBzg obQ09O6Rp6YO5S+hddv0536mPe3VavHwMI739bGAk0Y908zvRE9oJ/aFlKCLIocEhu+L T1+8R8hV+qXckK4C9UR6fvh48rrz9CHC+x4BCfLdO1yUvEBLkDb5ZUItlPK2S2tKajxi YMhfIa+2VTD3NFxRlksmtRMzlZsQzYnN7VLl+Qr3tITk5Rvo9YUkQVvMVV2MFl6DNDgF LQGx47n/OxbK4HSfTonLvNvrXdEVEGu7A7xPzFlaL1Ej6ZA9noQTYumrv6C87W1Cd9Po F14Q== X-Gm-Message-State: AOJu0Yz7LoKc9KV+bDs4XsnaJvVEC/sTQdxnQaQM6MQDA8qhigxo9+7H uk47NCGw4cQaPGOFg/+kIRBuOmQJDl1CkVPLokBfoY2/JoIowR7K6KYHDPCnP+MubF2CxmcIlZD iMPI= X-Gm-Gg: ASbGncsYHoa0H7QvSfn7nY251lv5HeAdhsfMLMsaCcLWNMs6Y/C0h4gS7L8f6YPu46w 1ENcd/FHtsP4gYcu/DoMERkuu8QtUG0Q5GFIsWU4WuBbki5QV1+p6Ovrpd+P+x/kf5CkR/QeO2+ zSRLIEHO7TssUwj+pY6cRWqldIr/qpz281+O4pkplVdODg9QtXyEgRXhEOUXgnKgfSwkGKyJZSW 4rJ5x0HXWifJXa8rebtLOee21+YWPeZM+rHQ9Bi5hYuacfecvx6B8k00HhIVZkw/ZS3BLbBvbJf IQ== X-Google-Smtp-Source: AGHT+IFwv6Axujkl5ZNLFu637t6GD4k3/1VARc8VhvqW5pBBbqSwRM3Mg0evgKeSr9OBhjgwSrKglw== X-Received: by 2002:a17:907:1b93:b0:aac:4325:a604 with SMTP id a640c23a62f3a-aac4325b81fmr930413866b.49.1734975574050; Mon, 23 Dec 2024 09:39:34 -0800 (PST) Received: from localhost.localdomain ([2001:871:260:ea51:b5e7:c1bb:bc75:c6ee]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0efe41a6sm549924466b.102.2024.12.23.09.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 09:39:33 -0800 (PST) Message-ID: Subject: Re: Commit 5a2fed911a broke parallel query From: Laurenz Albe To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org Date: Mon, 23 Dec 2024 18:39:33 +0100 In-Reply-To: <1408486.1734973973@sss.pgh.pa.us> References: <8befc845430ba1ae3748af900af298788e579c89.camel@cybertec.at> <1349368.1734968136@sss.pgh.pa.us> <1408486.1734973973@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.2 (3.54.2-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2024-12-23 at 12:12 -0500, Tom Lane wrote: > I wrote: > > In the security-team discussion that led up to 73c9f91a1, I'd been > > wondering why parallel worker start enforces any connection > > restrictions at all. If we'd like the use of parallelism to be > > more-or-less transparent, we shouldn't apply these checks, > > and not the !am_superuser ones in InitPostgres either. >=20 > That is, the way I'd prefer to attack this is something along the > lines of the attached, which just disables all those checks in > parallel workers (and reverts 73c9f91a1's hackery on am_superuser). >=20 > One big question this raises is whether any other sorts of background > processes should be treated similarly. >=20 > Another loose end is that I don't think the enforcement of > datconnlimit is very sane. CountDBBackends skips processes that say > AmBackgroundWorkerProcess, so logically those should be precisely the > ones that escape enforcement of datconnlimit, but it doesn't quite > work like that today. This patch at least puts parallel workers on > the right side of the line; but I think we have some cleanup to do > for other sorts of auxiliary processes. >=20 > I'm also wondering if we could revisit the need for > CheckMyDatabase's override_allow_connections parameter > and thereby remove INIT_PG_OVERRIDE_ALLOW_CONNS. > So all in all, this is just at the POC stage. Thanks for looking at this problem. I think that disabling the connect privilege check for parallel workers is the right thing to do. Getting permission problems just because PostgreSQL decided to use parallel query doesn't make any sense. I'm not sure about other background workers, but my guts say that they shouldn't check for the connect privilege either. I agree that background workers shouldn't count against a connection limit, but against "max_worker_processes". Yours, Laurenz Albe