Re: possible bug not in open items - Mailing list pgsql-bugs

From Tom Lane
Subject Re: possible bug not in open items
Date
Msg-id 28362.1239389252@sss.pgh.pa.us
Whole thread Raw
In response to Re: possible bug not in open items  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: possible bug not in open items  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-bugs
Jeff Davis <pgsql@j-davis.com> writes:
> Here is a patch that does what I think Heikki was suggesting. If a
> proper fix is non-trivial, then I assume there's some problem with my
> patch, but I'll post it for the archives anyway.

This patch is so wrong that it's scary.  You can't have
ImmediateInterruptOK true over the duration of any significant amount of
backend processing --- as an example, if you take control away in the
middle of a malloc call, you'll probably be left with a corrupt malloc
arena.

It doesn't even work to try to take control away while control is
inside, say, the OpenSSL code.  The reason we have the
prepare_for_client_read/client_read_ended hooks is to allow the flag to
be turned on over a sufficiently narrow scope --- to wit, the recv()
kernel call and nothing else --- that it's safe.

AFAICS, a safe patch for this has got to involve teaching those hooks
about COPY mode.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Stephen Frost
Date:
Subject: Re: libpq 8.4 beta1: $PGHOST complains about missing root.crt
Next
From: Bruce Momjian
Date:
Subject: Re: libpq 8.4 beta1: $PGHOST complains about missing root.crt