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-06T16:13:32Z
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
On Wed, Aug 6, 2025 at 8:04 AM Thomas Munro <thomas.munro@gmail.com> wrote: > * If it returns 1, then it stopped on the first level-triggered event > that it rechecked and found to be still true. Who cares if there are > more that didn't get rechecked? poll(fd) will report POLLIN either > way, and that's what you want. I think the weaker guarantee might be sufficient. I was trying to get a stronger primitive in place so that we wouldn't have to worry about it down the line, but it is a lot of code to pay... One sharp edge of that strategy is caught by the new tests, which is that if you call drain_socket_events() and then unset the timer, your multiplexer is still readable until you call drain_socket_events() yet again. At the moment, our code only ever calls those two in the opposite order (due to the race condition pointed out in 0002); we'd just have to keep that in mind. Maybe "drain" would no longer be the verb to use there. --Jacob