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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Yuli Khodorkovskiy <yuli.khodorkovskiy@crunchydata.com>, pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Date: 2019-05-16T03:56:17Z
Lists: pgsql-bugs
On Wed, May 15, 2019 at 11:32:38PM -0400, Tom Lane wrote:
> Michael Paquier <michael@paquier.xyz> writes:
> > Also, I am noticing another consequence as the handling of backend
> > variable files also suffers consequences:
> > could not open backend variables file
> > "pgsql_tmp/pgsql_tmp.backend_var.21912.1": No such file or directory
> 
> Um ... where/how are you seeing that?

On HEAD with EXEC_BACKEND, just like that:
$ cd src/bin/pg_ctl && PROVE_TESTS=t/004_logrotate.pl make check
$ cat tmp_check/log/004_logrotate_primary.log
2019-05-16 12:44:03.427 JST [26433] LOG:  redirecting log output to
logging collector process
2019-05-16 12:44:03.427 JST [26433] HINT:  Future log output will
appear in directory "log".
could not open backend variables file
"pgsql_tmp/pgsql_tmp.backend_var.26433.1": No such file or directory

The test is able to pass, but we have a race condition between the
moment the backend file gets saved and the moment we allow it to be
read.   I have not spent much time checking the stack between
InitializeMaxBackends() and RemovePgTempFiles() in postmaster.c, but
57431a9 triggers the failure.
--
Michael

Commits

  1. Rearrange postmaster's startup sequence for better syslogger results.

  2. Improve logrotate test so that it meaningfully exercises syslogger.

  3. Revert "postmaster: Start syslogger earlier".

  4. postmaster: Start syslogger earlier