Re: libpqrcv_PQexec() seems to violate latch protocol

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: libpqrcv_PQexec() seems to violate latch protocol
Date: 2017-06-06 21:14:59
Message-ID: 1236.1496783699@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> The function in $subject does:

> ResetLatch(&MyProc->procLatch);
> rc = WaitLatchOrSocket(&MyProc->procLatch,
> WL_POSTMASTER_DEATH | WL_SOCKET_READABLE |
> WL_LATCH_SET,
> PQsocket(streamConn),
> 0,
> WAIT_EVENT_LIBPQWALRECEIVER);

Yeah, this is certainly broken.

> Afaict, the ResetLatch() really should just instead be in the if (rc & WL_LATCH_SET) block.

And, to be specific, it should be before the CHECK_FOR_INTERRUPTS call,
since that is the useful work that we want to be sure occurs after
any latch-setting event.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-06-06 21:17:00 Re: libpqrcv_PQexec() seems to violate latch protocol
Previous Message Andres Freund 2017-06-06 21:04:05 libpqrcv_PQexec() seems to violate latch protocol