On Sat, Jan 14, 2023 at 10:50 PM Andres Freund <andres@anarazel.de> wrote:
> On 2023-01-14 08:02:01 -0800, Andres Freund wrote:
>
> I wonder if we ought to put a
> Assert(InterruptHoldoffCount == 0 && CritSectionCount == 0)
>
> in some of the routines in libpqwalreceiver to protect against issues like
> this. It'd be easy enough to introduce one accidentally, due to holding an
> lwlock.
>
This makes sense to me. How about adding this assert in all routines
in libpqwalreceiver that communicate over the network? That means to
add assert except for routines libpqrcv_get_senderinfo,
libpqrcv_get_conninfo, libpqrcv_check_conninfo,
libpqrcv_server_version, libpqrcv_get_backend_pid where we don't
communicate over the network.
There would be one exception to the above which is that we can't add
this assert in libpqrcv_disconnect as that will be called at the time
of proc exit and we set InterruptHoldoffCount as 1 in
proc_exit_prepare. I think that should be fine.
--
With Regards,
Amit Kapila.