public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: [email protected]
Cc: [email protected]
Subject: Re: BUG #19391: pg_ctl: the PID file "/xxxx/postmaster.pid" is empty
Date: Fri, 30 Jan 2026 20:52:48 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

PG Bug reporting form <[email protected]> writes:
> My test framework uses "pg_ctl status ..." to detect a state of Postgres
> instance - uninitialized, stopped, running.
> Time from time, it returns the error - pg_ctl: the PID file
> "/xxxx/postmaster.pid" is empty

If you're issuing "pg_ctl status" while a postmaster is starting, it's
possible that you're hitting the tiny window where CreateLockFile()
has opened the file but not yet written anything into it.

We could imagine making pg_ctl not treat this as an error, but
I'm hesitant to do so because of possibly creating race conditions
for the pg_ctl start/stop cases.  (Well, it's inherently a race
situation if you issue two concurrent starts ... what I mean is
that failing is the safest option in that scenario.)  Depending
on what you intend to do with the pg_ctl status result, acting
as if this isn't an error case could be risky there too.
Given an empty file, we can't distinguish "a postmaster is in
progress of starting" from "a postmaster died while starting",
since no PID is available to test.

			regards, tom lane






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: BUG #19391: pg_ctl: the PID file "/xxxx/postmaster.pid" is empty
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox