Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5864~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5864
Choose a head ref
  • 5 commits
  • 6 files changed
  • 2 contributors

Commits on Aug 4, 2025

  1. oauth: Remove stale events from the kqueue multiplexer

    If a socket is added to the kqueue, becomes readable/writable, and
    subsequently becomes non-readable/writable again, the kqueue itself will
    remain readable until either the socket registration is removed, or the
    stale event is cleared via a call to kevent().
    
    In many simple cases, Curl itself will remove the socket registration
    quickly, but in real-world usage, this is not guaranteed to happen. The
    kqueue can then remain stuck in a permanently readable state until the
    request ends, which results in pointless wakeups for the client and
    wasted CPU time.
    
    Implement drain_socket_events() to call kevent() and unstick any stale
    events. This is called right after drive_request(), before we return
    control to the client to wait. To make sure we've taken a look at the
    entire queue, register_socket() now tracks the number of outstanding
    registrations.
    
    Suggested-by: Thomas Munro <[email protected]>
    jchampio authored and Commitfest Bot committed Aug 4, 2025
    Configuration menu
    Copy the full SHA
    5ecf4d0 View commit details
    Browse the repository at this point in the history
  2. oauth: Remove expired timers from the multiplexer

    In a case similar to the previous commit, an expired timer can remain
    permanently readable if Curl does not remove the timeout itself. Since
    that removal isn't guaranteed to happen in real-world situations,
    implement drain_timer_events() to reset the timer before calling into
    drive_request().
    
    Moving to drain_timer_events() happens to fix a logic bug in the
    previous caller of timer_expired(), which treated an error condition as
    if the timer were expired instead of bailing out.
    
    The previous implementation of timer_expired() gave differing results
    for epoll and kqueue if the timer was reset. (For epoll, a reset timer
    was considered to be expired, and for kqueue it was not.) This didn't
    previously cause problems, since timer_expired() was only called while
    the timer was known to be set, but both implementations now use the
    kqueue logic.
    jchampio authored and Commitfest Bot committed Aug 4, 2025
    Configuration menu
    Copy the full SHA
    ad61c53 View commit details
    Browse the repository at this point in the history
  3. oauth: Track total call count during a client flow

    Tracking down the bugs that led to the addition of drain_socket_events()
    and drain_timer_events() was difficult, because an inefficient flow is
    not visibly different from one that is working properly. To help
    maintainers notice when something has gone wrong, track the number of
    calls into the flow as part of debug mode, and print the total when the
    flow finishes.
    
    A new test makes sure the total count is less than 100. (We expect
    something on the order of 10.) This isn't foolproof, but it is able to
    catch several regressions in the logic of the prior two commits, and
    future work to add TLS support to the oauth_validator test server should
    strengthen it as well.
    jchampio authored and Commitfest Bot committed Aug 4, 2025
    Configuration menu
    Copy the full SHA
    711cd29 View commit details
    Browse the repository at this point in the history
  4. oauth: Add unit tests for multiplexer handling

    To better record the internal behaviors of oauth-curl.c, add a unit test
    suite for the socket and timer handling code. This is all based on TAP
    and driven by our existing Test::More infrastructure.
    jchampio authored and Commitfest Bot committed Aug 4, 2025
    Configuration menu
    Copy the full SHA
    3fbb6b9 View commit details
    Browse the repository at this point in the history
  5. [CF 5864] v2 - OAuth: fix performance bug with stuck multiplexer events

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5864
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAOYmi+mRhhzGUvrcdickepAnsdaGbqhNcboNe4-YvgtkSzGNbQ@mail.gmail.com
    Author(s): Jacob Champion
    Commitfest Bot committed Aug 4, 2025
    Configuration menu
    Copy the full SHA
    99d82b3 View commit details
    Browse the repository at this point in the history
Loading