Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events
Jacob Champion <jacob.champion@enterprisedb.com>
From: Jacob Champion <jacob.champion@enterprisedb.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Daniel Gustafsson <daniel@yesql.se>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-08-06T23:55:44Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
oauth: Always link with -lm for floor()
- e76738e59790 18.0 landed
- 52ecd05aeef8 19 (unreleased) landed
-
oauth: Add unit tests for multiplexer handling
- 4e1e417330d4 19 (unreleased) landed
- 1443b6c0eaa2 19 (unreleased) landed
-
oauth: Ensure unused socket registrations are removed
- 16b0c48583a5 18.0 landed
- 3d9c03429a82 19 (unreleased) landed
-
oauth: Remove expired timers from the multiplexer
- e507e08acf63 18.0 landed
- 1749a12f0d20 19 (unreleased) landed
-
oauth: Remove stale events from the kqueue multiplexer
- ff181d1f876f 18.0 landed
- ff5b0824b3b0 19 (unreleased) landed
-
oauth: Track total call count during a client flow
- 41aac1483a6c 18.0 landed
- 3e311664e497 19 (unreleased) landed
Attachments
- since-v2.diff.txt (text/plain)
- v3-0001-oauth-Remove-stale-events-from-the-kqueue-multipl.patch (application/octet-stream) patch v3-0001
- v3-0002-oauth-Ensure-unused-socket-registrations-are-remo.patch (application/octet-stream) patch v3-0002
- v3-0003-oauth-Remove-expired-timers-from-the-multiplexer.patch (application/octet-stream) patch v3-0003
- v3-0004-oauth-Track-total-call-count-during-a-client-flow.patch (application/octet-stream) patch v3-0004
- v3-0005-oauth-Add-unit-tests-for-multiplexer-handling.patch (application/octet-stream) patch v3-0005
On Wed, Aug 6, 2025 at 9:13 AM Jacob Champion <jacob.champion@enterprisedb.com> wrote: > Maybe "drain" would no longer be the > verb to use there. I keep describing this as "combing" the queue when I talk about it in person, so v3-0001 renames this new operation to comb_multiplexer(). And the CI (plus the more strenuous TLS tests) confirms that the callback count is still stable with this weaker guarantee, so I've gotten rid of the event-counting code. Now that I'm no longer counting events, I can collapse the changes to register_socket(). I can't revert those changes entirely, because then we regress the case where Curl switches a socket from IN to OUT (this is enforced by the new unit tests). But I'm not sure that the existing comment adequately explained that fix anyway, and I didn't remember to call it out in my initial email, so I've split it out into v3-0002. It's much smaller. The tests (now in 0005) have been adjusted for the new "combing" behavior, and I've added a case to ensure that multiple stale events are swept up by a single call to comb_multiplexer(). Thanks! --Jacob