On Sun, Oct 06, 2019 at 08:15:10PM +0100, Rob Emery wrote:
> Hello,
>
> I've already posted this to pg_hackers, but I'm not sure if it's
> more normal to post proposed fixes against the bug itself; so see
> attached if needed.
Discussing patches on -bugs threads is perfectly fine :)
Regarding your patch, anything living in the middle of processing
(basically calling disconnect_and_exit() in ~11 and exit() for 12~)
would fail into this category. Wouldn't it make sense here to use
atexit() to ensure that the cleanup always happens? I am not sure
that it is a good idea to hope that anything processing the base
backup COPY chunks will remember to clean up those handles in the
event of an error. I am ready to bet that any future code will forget
to add that so we would keep falling into the same trap.
--
Michael