Re: [HACKERS] Weaker shmem interlock w/o postmaster.pid

Noah Misch <noah@leadboat.com>

From: Noah Misch <noah@leadboat.com>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-11-30T06:51:40Z
Lists: pgsql-hackers
On Thu, Nov 29, 2018 at 01:10:57PM +0100, Dmitry Dolgov wrote:
> On Sun, Aug 12, 2018 at 8:48 AM Noah Misch <noah@leadboat.com> wrote:
> > With 9.3 having a few months left, that's less interesting, but ...

> I'm a bit out of context, but taking into account that 9.3 is already beyond
> EOL, is it still interesting?

Yes.

> As a side note, with this patch recovery tests are failing now on 016_shm.pl
> 
> #   Failed test 'detected live backend via shared memory'
> #   at t/016_shm.pl line 87.
> #                   '2018-11-28 13:08:08.504 UTC [21924] LOG:
> listening on Unix socket "/tmp/yV2oDNcG8e/gnat/.s.PGSQL.512"
> # 2018-11-28 13:08:08.512 UTC [21925] LOG:  database system was
> interrupted; last known up at 2018-11-28 13:08:08 UTC
> # 2018-11-28 13:08:08.512 UTC [21925] LOG:  database system was not
> properly shut down; automatic recovery in progress
> # 2018-11-28 13:08:08.512 UTC [21925] LOG:  invalid record length at
> 0/165FEF8: wanted 24, got 0
> # 2018-11-28 13:08:08.512 UTC [21925] LOG:  redo is not required
> # 2018-11-28 13:08:08.516 UTC [21924] LOG:  database system is ready
> to accept connections
> # '
> #     doesn't match '(?^:pre-existing shared memory block)'

Thanks for the report.  Since commit cfdf4dc made pg_sleep() react to
postmaster death, the test will need a different way to stall a backend.  This
doesn't affect non-test code, and the test still passes against cfdf4dc^ and
against REL_11_STABLE.  I've queued a task to update the test code, but review
can proceed in parallel.


Commits

  1. Probe only 127.0.0.1 when looking for ports on Unix.

  2. Don't write to stdin of a test process that could have already exited.

  3. Test both 0.0.0.0 and 127.0.0.x addresses to find a usable port.

  4. MSYS: Translate REGRESS_SHLIB to a Windows file name.

  5. MSYS: Skip src/test/recovery/t/017_shm.pl.

  6. When Perl "kill(9, ...)" fails, try "pg_ctl kill".

  7. Consistently test for in-use shared memory.

  8. Revert "Consistently test for in-use shared memory."

  9. Silence -Wimplicit-fallthrough in sysv_shmem.c.

  10. Make src/test/recovery/t/017_shm.pl safe for concurrent execution.

  11. Update HINT for pre-existing shared memory block.

  12. Add WL_EXIT_ON_PM_DEATH pseudo-event.

  13. The default values for shared_buffers and max_connections are now 1000

  14. XLOG (and related) changes:

  15. Significant cleanups in SysV IPC handling (shared mem and semaphores).