Re: [sqlsmith] stuck spinlock in pg_stat_get_wal_receiver after OOM

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andreas Seltenreich <seltenreich@gmx.de>, pgsql-hackers@postgresql.org, Alvaro Herrera <alvherre@2ndquadrant.com>, Michael Paquier <michael.paquier@gmail.com>
Date: 2017-10-02T21:32:15Z
Lists: pgsql-hackers
On 2017-10-02 17:30:25 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Yes, that'd be a bad idea. It's not great to have memcpys in a critical
> > section, but it's way better than pallocs. So we need to use some local
> > buffers that this get copied to.
> 
> Or replace the spinlock with an LWLock?

That'd probably be a good idea, but I'm loathe to do so in the back
branches. Not at this callsite, but some others, there's some potential
for contention.

Greetings,

Andres Freund


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