Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Yuli Khodorkovskiy <yuli(dot)khodorkovskiy(at)crunchydata(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND
Date: 2019-09-10 05:28:51
Message-ID: 6728.1568093331@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(at)paquier(dot)xyz> writes:
> Do we need to worry about the port being opened after the external PID
> file is written though? With some imagination it is possible to
> imagine that some folks rely on the external PID file to be present
> before attempting to access Postgres when not using pg_ctl. Still, I
> would discard that as postmaster.pid gets written before opening the
> port already.

Hm, that's a good point. Extending my comment upthread, the existing
code sequence is

* create datadir lock file
* create sockets
* create shmem
* create external PID file, if requested
* launch syslogger

which this patch proposes to rearrange to

* create datadir lock file
* create shmem
* create external PID file, if requested
* launch syslogger
* create sockets

As far as the datadir lock file is concerned, it's there first in any case.
You could imagine some external code that expects that the socket-related
lines in postmaster.pid will be filled before the shmem key line is,
in which case this patch would break it. But it's hard to see exactly
what such an expectation would consist of. There isn't really any
good reason for external code to look at the shmem key line at all.

But the external PID file is a different story. I can believe that
something might be expecting the sockets to be open before we create
that file --- and since we're not using that file for an interlock,
there's no reason to be in a hurry to create it. I think it'd make
sense to move that step further down, so it's still done after the
create-sockets step.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-09-10 05:39:23 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND
Previous Message Michael Paquier 2019-09-10 05:11:15 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND