Attempt to stop dead instance can stop a random process?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Attempt to stop dead instance can stop a random process?
Date: 2007-08-31 17:02:39
Message-ID: 46D8035F.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It appears that when pg_ctl gets a stop request for a given directory, it looks for a pid file in that directory and signals that pid to stop. It doesn't appear to check that the pid is for a PostgreSQL postmaster running out of the given directory. I think it should, although on a quick scan of the code, I didn't see a convenient way to do that.

I have some evidence that when we attempted to stop a PostgreSQL instance which (it turned out) had died without cleaning up the pid file, it actually stopped another instance which was using a different data directory but had wrapped around to the same pid.

I guess if we ran each instance under a different OS user we would be protected from this, but that we hadn't thought that was necessary. Besides, we have other processes running under that OS login for maintenance or as part of the recovery processing.

-Kevin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Decibel! 2007-08-31 17:17:14 Re: enum types and binary queries
Previous Message Andrew Dunstan 2007-08-31 16:37:16 Re: Password requirement in windows installer