Re: Periodic authorization expiration checks using GoAway message - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: Periodic authorization expiration checks using GoAway message
Date
Msg-id CAOYmi+kputt5Geaj6H4BhQmFyPUubUzJpdja6uCsaP7wy3T6JA@mail.gmail.com
Whole thread Raw
In response to Re: Periodic authorization expiration checks using GoAway message  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Responses Re: Periodic authorization expiration checks using GoAway message
List pgsql-hackers
On Thu, Dec 11, 2025 at 4:36 PM Jelte Fennema-Nio <postgres@jeltef.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Qual push down to table AM
Next
From: Bryan Green
Date:
Subject: Re: PRI?64 vs Visual Studio (2022)