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 1wu8Qv-000UTD-39 for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Aug 2026 12:51:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wu8Qt-007ts3-2G for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Aug 2026 12:51:48 +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 1wu8Qt-007trv-1R for pgsql-bugs@lists.postgresql.org; Wed, 12 Aug 2026 12:51:48 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wu8Qs-00000000H76-2bsK for pgsql-bugs@lists.postgresql.org; Wed, 12 Aug 2026 12:51:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 67CCpfmw2622435; Wed, 12 Aug 2026 08:51:42 -0400 From: Tom Lane To: =?utf-8?Q?=C3=81lvaro?= Herrera cc: Daniel Gustafsson , scherbakov_lo_radarmms@mail.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19610: Database won't start if an unrelated process is exist In-reply-to: References: Comments: In-reply-to =?utf-8?Q?=C3=81lvaro?= Herrera message dated "Wed, 12 Aug 2026 13:26:14 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2622433.1786539101.1@sss.pgh.pa.us> Date: Wed, 12 Aug 2026 08:51:41 -0400 Message-ID: <2622434.1786539101@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?utf-8?Q?=C3=81lvaro?= Herrera writes: > Well, I'm not sure this is really intended. I'd say it's rather > emergent behavior from what we can do, which is to inquiry whether a > process with that PID exist or not; and if it does, we assume it's the > postmaster and give up. But maybe there are ways to verify whether it's > really a postmaster that indeed corresponds to that .pid file; so that > if we can determine it's not, then the .pid file is stale and we can > remove it and move on. We already check that the PID belongs to our own UID, and is not our parent or grandparent. I doubt there is more that we can do portably. We've already expended a bunch of sweat in this direction, eg commit 8f5500e6b. To my mind, this false-positive is only likely to happen if you have a bunch of unrelated stuff getting run under the same UID, which is already a security problem of the first magnitude. Don't do that: create a dedicated UID for each Postgres instance you plan to run. > If we get it wrong, the user ends up with corrupt data which definitely > is not nice. Yeah. Erring in the direction of thinking it's safe when it isn't is far worse than erring in this direction. regards, tom lane