Re: BUG #14821: idle_in_transaction_session_timeout sometimes gets ignored when statement timeout is pending

From: Andres Freund <andres(at)anarazel(dot)de>
To: lukas(at)fittl(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14821: idle_in_transaction_session_timeout sometimes gets ignored when statement timeout is pending
Date: 2017-09-21 01:29:31
Message-ID: 20170921012931.zv5pcdlxsvstqzwl@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2017-09-21 01:09:56 +0000, lukas(at)fittl(dot)com wrote:
> It seems to me that ProcessInterrupts() should check for the idle in
> transaction timeout first, since it short-circuits and returns early if
> QueryCancelPending && QueryCancelHoldoffCount != 0 before even getting
> there.

Indeed - although I wonder if the correct fix isn't to move things
around, but to instead avoid the order dependency changing the short
circuit logic so that there's no early return. Like e.g.

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

there's really no good reason for the return right now, and it's bound
to create more bugs in the future.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Lukas Fittl 2017-09-21 01:39:23 Re: BUG #14821: idle_in_transaction_session_timeout sometimes gets ignored when statement timeout is pending
Previous Message lukas 2017-09-21 01:09:56 BUG #14821: idle_in_transaction_session_timeout sometimes gets ignored when statement timeout is pending