postgres-github.git / summary / log / commit / refs

commit    c0b24b32b0d3776435923d55396cc43fc657ecc5
Author:   Fujii Masao <fujii@postgresql.org>
Date:     Fri May 01 03:12:44 2026 +0000

    Avoid blocking indefinitely while finishing walsender shutdown
    
    When walsender finishes streaming during shutdown, it sends a
    CommandComplete message to tell the receiver that WAL streaming is done.
    Previously, that path used EndCommand() followed by pq_flush().
    
    Those functions can block indefinitely waiting for the socket to become
    writeable. As a result, even when wal_sender_shutdown_timeout is set,
    walsender could remain stuck while sending the final completion message,
    and the shutdown timeout would not be enforced.
    
    Fix this by introducing EndCommandExtended(), which allows
    CommandComplete to be queued with pq_putmessage_noblock(), and by
    using the walsender nonblocking flush path instead of pq_flush(), so
    the shutdown timeout continues to be checked while pending output is
    flushed.
    
    Per CI testing on FreeBSD.
    
    Reported-by: Andres Freund <andres@anarazel.de>
    Author: Fujii Masao <masao.fujii@gmail.com>
    Reviewed-by: Chao Li <li.evan.chao@gmail.com>
    Discussion: https://postgr.es/m/vwlugmsogfn36jhm56zwrgd7m6xe6ircltvfh3kzt6kldvbtht@f45dgow5uhnx

[parent: f76686ce7f77]