rsyslog/tests/omhttp-retry.sh
Rainer Gerhards 2bb5846f9f omhttp: fix shared health state and gzip headers
Why
The PR baseline still left a few regressions in omhttp retry handling,
header setup, and cleanup paths.

Impact
Retries keep their previous behavior, compressed requests carry the
correct headers, and worker/server state cleanup is consistent.

Before/After
Before, health-check throttling was still worker-local and compressed
POSTs could reuse a non-gzip header set; after, shared health state is
tracked globally and headers follow the actual payload encoding.

Technical Overview
Add shared per-server last-check timestamps in instance state so workers
observe the same health-check throttle window.
Separate send-failure suspension from failed health-check backoff so the
default healthchecktimedelay=-1 still allows immediate retry probing.
Rebuild per-server curl headers whenever gzip usage changes so
Content-Encoding matches the request body, which restores compressed
batch compatibility such as the VictoriaLogs path.
Tighten worker/server cleanup by zero-initializing the server pointer
array, centralizing server-data destruction, and fixing dynamic
rest-path replacement leaks.

With the help of AI-Agents: Codex
2026-03-27 12:07:25 +01:00

48 lines
914 B
Bash
Executable File

#!/bin/bash
# This file is part of the rsyslog project, released under ASL 2.0
# Starting actual testbench
. ${srcdir:=.}/diag.sh init
export NUMMESSAGES=5000
export SEQ_CHECK_OPTIONS="-d"
omhttp_start_server 0 --fail-every 1000
generate_conf
add_conf '
module(load="../contrib/omhttp/.libs/omhttp")
main_queue(queue.dequeueBatchSize="2048")
template(name="tpl" type="string"
string="{\"msgnum\":\"%msg:F,58:2%\"}")
if $msg contains "msgnum:" then
action(
# Payload
action.resumeRetryCount="-1"
name="my_http_action"
type="omhttp"
errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
template="tpl"
server="localhost"
serverport="'$omhttp_server_lstnport'"
restpath="my/endpoint"
checkpath="ping"
batch="off"
# Auth
usehttps="off"
)
'
startup
injectmsg
shutdown_when_empty
wait_shutdown
omhttp_get_data $omhttp_server_lstnport my/endpoint
omhttp_stop_server
seq_check
exit_test