Обсуждение: Re: [BUGS] BUG #14821: idle_in_transaction_session_timeout sometimesgets ignored when statement timeout is pending

Поиск
Список
Период
Сортировка
Hi,

As per the bug report at https://www.postgresql.org/message-id/20170921010956.17345.61461%40wrigleys.postgresql.org it seems that the query cancellation holdoff logic in ProcessInterrupts is a bit overly aggressive in keeping other interrupts from running.

In particular I've seen an issue in the wild where idle_in_transaction_session_timeout did not get triggered because the HOLD_CANCEL_INTERRUPTS() in SocketBackend wraps around a pq_getbyte() call, and so ProcessInterrupts doesn't do anything when it gets called because the query cancel holdoff counter is positive.

Andres suggested the following re-ordering of the logic on -bugs:
 
On Wed, Sep 20, 2017 at 6:29 PM, Andres Freund <andres@anarazel.de> wrote:

        if (QueryCancelPending && QueryCancelHoldoffCount != 0)
        {
                /* rearm */
        }
        else if (QueryCancelPending)
        {
                /* handle interrupt */
        }

Which is implemented in the attached patch.

Unless someone wants to pick this up right away, I'll register it in the next commitfest tomorrow.

Best,
Lukas

--
Lukas Fittl
Вложения
Hi,

On 2017-09-20 20:27:05 -0700, Lukas Fittl wrote:
> As per the bug report at
> https://www.postgresql.org/message-id/20170921010956.17345.61461%40wrigleys.postgresql.org
> it seems that the query cancellation holdoff logic in ProcessInterrupts is
> a bit overly aggressive in keeping other interrupts from running.
> 
> In particular I've seen an issue in the wild where
> idle_in_transaction_session_timeout did not get triggered because
> the HOLD_CANCEL_INTERRUPTS() in SocketBackend wraps around a pq_getbyte()
> call, and so ProcessInterrupts doesn't do anything when it gets called
> because the query cancel holdoff counter is positive.
> 
> Andres suggested the following re-ordering of the logic on -bugs:

I've pushed this. Thanks for the report & fix!

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

On Wed, Oct 11, 2017 at 2:11 PM Andres Freund <andres@anarazel.de> wrote:
I've pushed this. Thanks for the report & fix!

Excellent, thanks!

Best,
Lukas
--
Lukas Fittl