[sqlsmith] stuck spinlock in pg_stat_get_wal_receiver after OOM

Andreas Seltenreich <seltenreich@gmx.de>

From: Andreas Seltenreich <seltenreich@gmx.de>
To: pgsql-hackers@postgresql.org
Date: 2017-10-02T20:56:49Z
Lists: pgsql-hackers
Hi,

low-memory testing with REL_10_STABLE at 1f19550a87 produced the
following PANIC:

    stuck spinlock detected at pg_stat_get_wal_receiver, walreceiver.c:1397

I was about to wrap the pstrdup()s with a PG_TRY block, but I can't find
a spinlock being released in a PG_CATCH block anywhere, so maybe that's
a bad idea?

regards,
Andreas


Commits

  1. Fix race condition with unprotected use of a latch pointer variable.

  2. Fix coding rules violations in walreceiver.c

  3. Use latch instead of select() in walreceiver