pgsql: oauth: Fix postcondition for set_timer on macOS

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: oauth: Fix postcondition for set_timer on macOS
Date: 2025-03-19 03:46:08
Message-ID: E1tukNc-003CXc-0k@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

oauth: Fix postcondition for set_timer on macOS

On macOS, readding an EVFILT_TIMER to a kqueue does not appear to clear
out previously queued timer events, so checks for timer expiration do
not work correctly during token retrieval. Switching to IPv4-only
communication exposes the problem, because libcurl is no longer clearing
out other timeouts related to Happy Eyeballs dual-stack handling.

Fully remove and re-register the kqueue timer events during each call to
set_timer(), to clear out any stale expirations.

Author: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Discussion: https://postgr.es/m/CAOYmi%2Bn4EDOOUL27_OqYT2-F2rS6S%2B3mK-ppWb2Ec92UEoUbYA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/434dbf6907ec8fafa6862a0f00385f293e63ac0e

Modified Files
--------------
src/interfaces/libpq/fe-auth-oauth-curl.c | 48 ++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2025-03-19 04:06:17 pgsql: oauth: Disallow synchronous DNS in libcurl
Previous Message Amit Langote 2025-03-19 03:14:56 pgsql: Ensure first ModifyTable rel initialized if all are pruned