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

Noah Misch <noah@leadboat.com>

From: Noah Misch <noah@leadboat.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>, "9erthalion6@gmail.com" <9erthalion6@gmail.com>, "sfrost@snowman.net" <sfrost@snowman.net>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2019-04-28T17:00:11Z
Lists: pgsql-hackers
On Fri, Mar 29, 2019 at 09:53:51AM +0000, Daniel Gustafsson wrote:
> On Saturday, March 9, 2019 8:16 AM, Noah Misch <noah@leadboat.com> wrote:
> > I tested on Red Hat and on Windows Server 2016; I won't be shocked
> > if the test (not the code under test) breaks on other Windows configurations.
> 
> IIRC there are Windows versions where Win32::Process::KillProcess is required
> for this, but thats admittedly somewhat dated knowledge. If the buildfarm goes
> red on older Windows animals it might be something to look at perhaps.

Since my second attempt at committing this (commit c098509), I fixed these
bugs in the new test file:

- MSYS-orchestrated mingw32 (buildfarm member jacana) failed the Perl kill(9,
  ...) calls[1].  For HEAD and v11, using "pg_ctl kill KILL <pid>" fixed that.
  For v10 and v9.6, I disabled the test under msys.  I can reproduce this with
  Perl 5.28 from msys2.  Its kill(9, ...) fails for any non-msys2 process (any
  ordinary Windows process).  [commits 947a350, 2bc0474]

- The regress.dll path needed MSYS-to-w32 path translation.  [commit 9daefff]

- The changes to port selection in get_new_node() made Linux-specific
  assumptions, so Windows builds had much less protection against port
  conflict.  [commit 4ab02e8]

- Got EPIPE when writing to stdin of a child process that exited too quickly.
  [commit e12a472]

Things have been stable on the buildfarm for the last twelve days, so I think
this one is over.

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=2019-04-13%2014%3A39%3A17



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).