From: Yeonggi Kim <[email protected]>

Hi,

Since 5da704b55 ("MEDIUM: log: Update the log applet to use its own
buffers"), merged in 3.3-dev4, syslog_io_handler() returns early on an
empty input buffer and no longer reaches applet_getchar(), which is
where it noticed the client's shutdown. A TCP syslog session of a
log-forward section whose client closes after its last message was
consumed therefore stays open. A log-forward section does not inherit
"timeout client" from the defaults section, so without one set in the
section, the session never ends.

Impact: each such client leaves a session behind, and a soft-stop then
waits for "hard-stop-after" (forever without it). We hit it on 3.4 with
a "ring" forwarding to a log-forward section of the same process: on
reload, the ring's forwarder closes its connection, the log-forward
session stays, and the old process is only stopped by
"hard-stop-after".

A reproducer is in the commit message of 1/2.

The series:
  - 1/2 lets an empty buffer reach applet_getchar() again, and only
    leaves early when no input buffer is available, like the dns and
    peers applets do.
  - 2/2 adds reg-tests/log/log_forward_tcp_close.vtc. It fails (timeout)
    without 1/2 on master bd884a2, 3.4.6 and 3.3.16, and passes with
    it, as well as on 3.2.25, which is not affected. The other
    reg-tests/log tests and reg-tests/ssl/log_forward_ssl.vtc pass with
    and without the series.

Both should be backported as far as 3.3.

Thanks,
Yeonggi Kim

Yeonggi Kim (2):
  BUG/MEDIUM: log: do not ignore the peer's shutdown in the syslog
    applet
  REGTESTS: log: check that a log-forward TCP session ends on client
    close

 reg-tests/log/log_forward_tcp_close.vtc | 60 +++++++++++++++++++++++++
 src/log.c                               |  7 ++-
 2 files changed, 65 insertions(+), 2 deletions(-)
 create mode 100644 reg-tests/log/log_forward_tcp_close.vtc

-- 
2.52.0



Reply via email to