Re: Periodic authorization expiration checks using GoAway message

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Hannu Krosing <hannuk(at)google(dot)com>, Ajit Awekar <ajitpostgres(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dave Cramer <davecramer(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: Periodic authorization expiration checks using GoAway message
Date: 2025-12-15 17:17:04
Message-ID: CAOYmi+kputt5Geaj6H4BhQmFyPUubUzJpdja6uCsaP7wy3T6JA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 11, 2025 at 4:36 PM Jelte Fennema-Nio <postgres(at)jeltef(dot)nl> wrote:
> > "you didn't reauthenticate in time, so now you
> > _have_ to reconnect, bye"
>
> I might be missing something but I feel like we currently do this in
> various other places using:
> FATAL: <message explaining reason>
> <connection close>

Part of the appeal to me is the ability for the client to decide to
transparently reconnect if possible, rather than surfacing an error to
the user. But if there's no other metadata to be used by the client
during that, then I suppose we could create a new 08Pxx SQLSTATE to
mean that. That does cover the backwards compatibility angle pretty
well.

> Yeah, pipelining is annoying for these kind of things. But looking
> it's not so bad. What if you define the flow as:
> 1. server sends 'R' message when it realizes it wants a
> re-authentication (allowed whenever, just like NoticeResponse)
> 2. client can continue to send whatever and server will respond accordingly
> 3a. client starts authentication flow by sending a 'p' message
> 3b. client did not complete auth flow within timeout of the server, so
> server sends FATAL + closes connection.

I think a timeout-based flow (though simple!) might be hard to
maintain for a DBA. It's basically a race condition that they would
have to tune. (I'm not saying I'm opposed to a timeout here; just that
the timeout should be a backstop for a misbehaved client, rather than
the thing the conversation is based on. The client should know what
it's allowed to finish up before reauthenticating.)

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bryan Green 2025-12-15 17:24:34 Re: PRI?64 vs Visual Studio (2022)
Previous Message Andres Freund 2025-12-15 17:14:44 Re: Qual push down to table AM