Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Jacob Champion <jacob.champion@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Daniel Gustafsson <daniel@yesql.se>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-08-06T15:03:57Z
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 Tue, Aug 5, 2025 at 3:24 AM Jacob Champion <jacob.champion@enterprisedb.com> wrote: > On Mon, Aug 4, 2025 at 7:53 AM Thomas Munro <thomas.munro@gmail.com> wrote: > > [FYI, I'm looking into this and planning to post a review in 1-2 days...] 0001: So, the problem is that poll(kqueue_fd) reports POLLIN if any events are queued, but level-triggered events are only rechecked and possibly cancelled if you actually call kevent(). Hmm, what if you just called kevent() with an output array of size one? * If it returns 0, that means it has rechecked all queued level-triggered events and booted them all out because they are no longer true. poll(fd) won't report POLLIN until one of them is queued again. * 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.