Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Fix PID file location?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: josh(at)agliodbs(dot)com,PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Fix PID file location?
Date: 2005-05-27 23:40:17
Message-ID: 1551.1117237217@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> I have generated the following patch that moves postmaster.pid into the
> configuration directory.  pg_ctl only knows about the configuration
> directory because it can't read postgresql.conf, so it seems that is the
> right place to move it.

Unfortunately, that is *absolutely* unsafe.  If we do that it will break
the safety property that the lock file is meant to enforce in the first
place, namely only one postmaster running in a given data directory.
It's not too hard to imagine people getting burnt by that, either:
initdb, create new config files in another directory, forget to remove
the original postgresql.conf in the data directory, and you have every
ingredient needed for disaster.  Just start two postmasters with both
direct and indirect -D arguments, and kaboom.

> This patch does
> require that the postgres unix user have write permission in the
> configuration directory to create the pid file on startup.

That assumption is unacceptable, too.  One of the prime reasons for
having config files somewhere else is that the somewhere else can be
read-only, thus reducing your exposure in case of a security breach.
(Otherwise, we could possibly fix this by generating a second
postmaster.pid in the config directory.)

I really think we have only two choices: teach pg_ctl how to dig the
data directory location out of postgresql.conf, or revert the
separate-config-file-location patch.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-05-28 00:24:25
Subject: Re: overlaps() does not work as expected?
Previous:From: Josh BerkusDate: 2005-05-27 23:35:17
Subject: Re: [HACKERS] Fix PID file location?

pgsql-patches by date

Next:From: Alvaro HerreraDate: 2005-05-28 00:31:51
Subject: Re: psql backslash consistency
Previous:From: Josh BerkusDate: 2005-05-27 23:35:17
Subject: Re: [HACKERS] Fix PID file location?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group