pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Don't allow immediate interrupts during authentication anymore.
Date: Tue, 03 Feb 2015 22:10:32 +0000
Message-ID: <E1YIlg0-00079G-91@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Don't allow immediate interrupts during authentication anymore.

We used to handle authentication_timeout by setting
ImmediateInterruptOK to true during large parts of the authentication
phase of a new connection.  While that happens to work acceptably in
practice, it's not particularly nice and has ugly corner cases.

Previous commits converted the FE/BE communication to use latches and
implemented support for interrupt handling during both
send/recv. Building on top of that work we can get rid of
ImmediateInterruptOK during authentication, by immediately treating
timeouts during authentication as a reason to die. As die interrupts
are handled immediately during client communication that provides a
sensibly quick reaction time to authentication timeout.

Additionally add a few CHECK_FOR_INTERRUPTS() to some more complex
authentication methods. More could be added, but this already should
provides a reasonable coverage.

While it this overall increases the maximum time till a timeout is
reacted to, it greatly reduces complexity and increases
reliability. That seems like a overall win. If the increase proves to
be noticeable we can deal with those cases by moving to nonblocking
network code and add interrupt checking there.

Reviewed-By: Heikki Linnakangas

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6647248e3708843be93c7ca670cd219fe8e61026

Modified Files
--------------
src/backend/libpq/auth.c              |   30 ++++++++++++++++++++----------
src/backend/libpq/be-secure-openssl.c |    5 +++++
src/backend/libpq/crypt.c             |   10 ----------
src/backend/tcop/postgres.c           |   17 +++++------------
src/backend/utils/init/postinit.c     |   16 +++++++++++-----
5 files changed, 41 insertions(+), 37 deletions(-)


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


Message-ID: <E1YIlg0-00079G-91@gemulon.postgresql.org>
Permalink:  ../E1YIlg0-00079G-91@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YIlg0-00079G-91@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Don't allow immediate interrupts during authentication anymore.
  In-Reply-To: <E1YIlg0-00079G-91@gemulon.postgresql.org>
  References: <E1YIlg0-00079G-91@gemulon.postgresql.org>

* 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