Re: [oauth] Bug: when is shutdown_cb called?

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [oauth] Bug: when is shutdown_cb called?
Date: 2026-02-28 01:04:13
Message-ID: 3C6699FD-277A-454A-A221-784DC13F392D@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Feb 28, 2026, at 00:55, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> wrote:
>
> On Wed, Feb 18, 2026 at 4:50 AM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>> Maybe we should just fix the documentation instead?
>
> Yeah, this is just a docs bug. It changed in v47 of the original
> patchset [1] but I forgot to update the documentation. (It was
> originally a before_shmem_exit implementation, which is why that fits
> the description well. :D)
>
> I propose the attached diff, with a backport to 18.
>
>> The advantages: things like expiration checks[2], or repeated
>> validation in the future when we implement token refresh need a
>> working validator state, which means either we have to call
>> startup/shutdown multiple times, or keep the context.
>
> Personally I think it's fine for more complicated behavior to require
> more integration into the existing server APIs. We don't need to
> reinvent OAuth-specific wheels; implementations will just need to pay
> attention to memory contexts and _PG_init like standard extensions
> already do.
>
> Thanks,
> --Jacob
>
> [1] https://www.postgresql.org/message-id/CAOYmi%2BnHG7oy%2BybHH72WjiXAQG3tE6v_at-K9ebRy2oqo92V%2BA%40mail.gmail.com
> <shutdown-docs.diff>

```
+ The <function>shutdown_cb</function> callback is executed when the server
+ backend has finished validating tokens for the connection. If the validator
```

“Server backend” sounds a bit uncommon in the documentation. I searched through the *.sgml files and couldn’t find much occurrences of that phrase. It seems that “backend process” is used consistently elsewhere.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-02-28 01:16:10 Re: pg_plan_advice
Previous Message Jacob Champion 2026-02-28 00:51:40 Re: Add ssl_(supported|shared)_groups to sslinfo