]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] upstream: add release() for non-success/failure paths
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 May 2026 10:34:25 +0000 (11:34 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 2 May 2026 10:34:25 +0000 (11:34 +0100)
commit32ff22877d83d81dadd70459fad985c8446a23ea
treecc9ffcba3427358a3f8b5e4460605d02440ae55b
parentd7607d2b2d4d777cab8af464039e475f984e78b6
[Fix] upstream: add release() for non-success/failure paths

The new inflight counter introduced for P2C exposed several pre-existing
leaks where a get_* selection had no matching ok()/fail() call. ok() was
unsuitable as a generic retire because it also clears the error count.

Add rspamd_upstream_release() — decrement inflight without touching
errors, latency, or watchers — and apply at four call sites:

- rspamd_proxy.c mirror loop: copy_msg failure after upstream selection
- rspamd_proxy.c master loop: copy_msg failure after upstream selection
- fuzzy_check.c PING: fire-and-forget address lookup
- http_connection.c proxy: hand-off path where new_common drops the
  upstream pointer (per-request tracking left for a follow-up)

Two more leak classes remain for separate PRs: Lua-side retire fallback
via __gc, and librdns retransmit/select pairing in dns.c.

Tests: 9 P2C cases (was 7; +2 covering release behaviour and null safety).
src/libserver/http/http_connection.c
src/libutil/upstream.c
src/libutil/upstream.h
src/plugins/fuzzy_check.c
src/rspamd_proxy.c
test/rspamd_cxx_unit_upstream_p2c.hxx