Re: BUG #19908: pg_upgrade --check crashes instance if running in a different PID Namespace then the old cluster

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: schefner20(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19908: pg_upgrade --check crashes instance if running in a different PID Namespace then the old cluster
Date: 2026-11-16 20:40:28
Message-ID: 145931.1794861628@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Nov 16, 2026 at 10:55 AM PG Bug reporting form
> <noreply(at)postgresql(dot)org> wrote:
>> Possible Explanation:
>> - pg_upgrade read the postmaster.pid and checked if the PID exists
>> - it then couldn't find a process with that PID because the container,
>> where pg_upgrade was running on, has its own PID namespace
>> - since it can't find the PID, pg_upgrade startet a second instance

> This is unfortunate, but I'm not sure what to do about it. Because the
> servers are running in different PID namespaces, and apparently also
> different IPC namespaces, the usual interlocks don't work, so when
> pg_upgrade tries to start a new postmaster, bad things can happen. The
> obvious answer is to never try to start a new server in --check mode,
> but then --check wouldn't be able to ignore a stale postmaster.pid
> file any more. I'm not sure how important it is for us to be able to
> ignore stale postmaster.pid files is here, but my guess is that some
> people would complain if we didn't.

Yeah, I think skipping this step would be a cure substantially more
dangerous than the disease. Note the comment in
check_clusters_stopped about ensuring that WAL replay is complete.

Moreover, I think making it safe or easy to run PG in this environment
is a bad idea. If you've got namespacing or other stuff that can
inhibit the ability of one would-be postmaster to see another one,
you are playing with fire. You need to not run things that way, or
someday you'll find your data eaten.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Adam Matthews 2026-11-16 20:51:25 16.16: join order regression for pg_indexes self-join (schema filter applied last), ~50x slower than 16.15
Previous Message Michael Malis 2026-11-16 20:28:12 GiST: SERIALIZABLE misses conflict when scan prunes at internal page