Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command.

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command.
Дата
Msg-id CAHGQGwGcq1B1NaTTGAT8=TJkjvnOmhR6JjScVVr-7y8K6R8ypw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command.  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTIONcommand.  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTION command.  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-committers
On Wed, Feb 22, 2017 at 6:57 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Wed, Feb 22, 2017 at 4:12 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Fujii Masao <fujii@postgresql.org> writes:
>>> Fix connection leak in DROP SUBSCRIPTION command.
>>> Previously the command forgot to close the connection to the publisher
>>> when it failed to drop the replication slot.
>>
>> If there's a bug here, this seems like an extremely unreliable way of
>> fixing it.  What if an error gets thrown before you reach that ereport?
>>
>> In other words, this coding is assuming that the walrcv_command()
>> subroutine cannot throw an error,

Yes, but I agree that walrcv_command() may be changed in the future so that
an error is thrown and current coding is not reliable in that case.

>> which I would consider dangerous
>> even if it were a fixed subroutine.  If it's a hook that's doing
>> unknown stuff, that seems a completely untenable assumption.  You
>> really need either to hook the cleanup action into normal error
>> recovery, or to use a PG_TRY block.
>
> To be honest, I have thought about using PG_ENSURE_ERROR_CLEANUP()
> when seeing the thread. If other ERROR messages are generated in the
> future that the current fix would be unreliable.

What about the attached patch?

Regards,

--
Fujii Masao

Вложения

В списке pgsql-committers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Make walsender always initialize the buffers.
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Fix connection leak in DROP SUBSCRIPTIONcommand.