From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <ishii@sraoss.co.jp>
Cc: thomas.munro@gmail.com
Cc: s.kelvich@postgrespro.ru
Cc: pgsql-hackers@postgresql.org
Subject: Re: Add client connection check during the execution of the query
Date: Thu, 18 Jul 2019 01:04:13 -0400
Message-ID: <31564.1563426253@sss.pgh.pa.us> (raw)
In-Reply-To: <20190718.134308.909519174866822804.t-ishii@sraoss.co.jp>
References: <CA+hUKGJ3-N0F7T_tcRnGZv0_g_DJwcYM2=XTYCHrvcFG2YrrWg@mail.gmail.com>
<20190718.121906.432767475415875714.t-ishii@sraoss.co.jp>
<CA+hUKGJtJM91cWqTby=EX=63ERjB5PumdSWKKmamLBE-QLXE+w@mail.gmail.com>
<20190718.134308.909519174866822804.t-ishii@sraoss.co.jp>
Tatsuo Ishii <ishii@sraoss.co.jp> writes:
>> Yeah, the timer logic is wrong. I didn't have time to look into it
>> but with truss/strace for some reason I see 3 setitimer() syscalls for
>> every query, but I think this doesn't even need to set the timer for
>> every query.
> Hum. I see 2 settimer(), instead of 3.
src/backend/utils/misc/timeout.c is not really designed for there
to be timeouts that persist across multiple queries. It can probably
be made better, but this patch doesn't appear to have touched any of
that logic.
To point to just one obvious problem, the error recovery path
(sigsetjmp block) in postgres.c does
disable_all_timeouts(false);
which cancels *all* timeouts. Probably don't want that behavior
anymore.
I think the issue you're complaining about may have to do with
the fact that if there's no statement timeout active, both
enable_statement_timeout and disable_statement_timeout will
call "disable_timeout(STATEMENT_TIMEOUT, false);". That does
nothing, as desired, if there are no other active timeouts ...
but if there is one, ie the client_connection timeout, we'll
end up calling schedule_alarm which will call setitimer even
if the desired time-of-nearest-timeout hasn't changed.
That was OK behavior for the set of timeouts that the code
was designed to handle, but we're going to need to be smarter
now.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, ishii@sraoss.co.jp, thomas.munro@gmail.com, s.kelvich@postgrespro.ru
Subject: Re: Add client connection check during the execution of the query
In-Reply-To: <31564.1563426253@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox