Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol
Date
Msg-id 1236.1496783699@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] libpqrcv_PQexec() seems to violate latch protocol  (Andres Freund <andres@anarazel.de>)
Responses Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] libpqrcv_PQexec() seems to violate latch protocol