Skip to content

feat(health-check): add a TCP connect probe mode and configurable accepted HTTP statuses - #1805

Merged
FlorentinDUBOIS merged 5 commits into
mainfrom
feat/health-check-tcp-mode
Oct 2, 2026
Merged

FlorentinDUBOIS merged 5 commits into
mainfrom
feat/health-check-tcp-mode

Conversation

@FlorentinDUBOIS

@FlorentinDUBOIS FlorentinDUBOIS commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1801

What

  • Probe mode — HealthCheckConfig.mode (proto field 7, HealthCheckMode, default HTTP):
    • HTTP: same behaviour as before.
    • TCP: the backend is healthy iff the TCP connection is established within timeout (the socket becomes writable with no SO_ERROR, peer_addr succeeds). Nothing is sent, and the stream is deregistered and dropped once connected. That sends a FIN on an empty receive queue, or an RST if a banner-first backend (SMTP, SSH) has already sent bytes the probe never reads.
    • uri is ignored. A non-zero expected_status or a non-empty accepted_statuses is refused in TCP mode at every validation layer.
    • It runs on the existing HealthChecker loop, so tokens, timeout, thresholds, metrics, events and fail-open are unchanged.
  • Accepted statuses — HealthCheckConfig.accepted_statuses (proto field 8, repeated HttpStatusRange { start, end }, inclusive):
    • TOML and CLI entries: "404", "200-399", "2xx", "any" (= 100-599). Bounds must lie in 100-599 (RFC 9110 §15).
    • When the list is set, it replaces expected_status. A non-zero expected_status together with a list is refused by validate_health_check_config, which the CLI, the TOML loader, ConfigState and the worker all call.
  • Final status only — HTTP probes skip interim 1xx responses (except 101), on HTTP/1.1 and on h2c. The h2c walk keeps one HPACK decoder across header blocks, so accepting 1xx or any never lets a 100 Continue stand in for a final 500.
    • The 4096-byte response cap covers interim responses too: a 103 Early Hints with more than about 4 KB of headers fails the probe.
  • Compatibility:
    • uri stays required on the wire and may be empty in TCP mode. The TOML uri and --uri default to /.
    • Both new fields carry #[serde(default)], so JSON saved states written before them still load. state_compat_v1_1_1 stays green.
    • A message without field 7 decodes as HTTP.
  • CLI — sozu cluster health-check set --mode http|tcp --accepted-statuses ….
    • list output changes: a new mode column, expected status becomes accepted statuses, and a legacy 0 is shown as 2xx instead of any 2xx.
    • In TOML, mode is "HTTP"/"TCP", case-sensitive like the other protocol enum keys. It is distinct from the UDP udp.health.mode = "TCP_PROBE".

Upgrade warning (also in CHANGELOG and doc/health_checks.md)

Upgrade the main process and every worker, and use the new CLI, before enabling tcp mode or accepted_statuses. Otherwise the default probe silently comes back: GET <uri> (/ if unset) accepting only 2xx, which marks down every 3xx/404/500 backend. This happens with:

  • an older worker running between sozu upgrade main and upgrade worker, which ignores fields 7 and 8;
  • an older sozu CLI doing read-modify-write (cluster h2 enable|disable re-sends AddCluster without fields 7 and 8);
  • an older binary loading a new saved state.

Downgrading while a cluster uses either field is not supported.

Library API (BREAKING):

  • HealthCheckConfig gains the public fields mode and accepted_statuses.
  • FileHealthCheckConfig gains mode and accepted_statuses.
  • FileHealthCheckConfig::to_proto now returns Result.
  • ConfigError gains InvalidHealthCheck.

Pre-existing bug fixed: health-check set always panicked

The subcommand's --timeout (u32) had the same clap id as the global -t/--timeout command timeout (u64), so every invocation panicked before sending anything:

$ sozu cluster health-check set --id app --uri /x
thread 'main' panicked at bin/src/cli.rs:25:18:
Mismatch between definition and access of `timeout`. Could not downcast to u64, need to downcast to u32

The probe timeout flag is now --probe-timeout (clap id probe_timeout). --timeout on health-check set is now the global command timeout, in milliseconds, not the probe timeout. cluster_health_check_set_parses_mode_and_accepted_statuses parses both timeouts together; it failed with this panic before the rename.

Protocol / security impact

  • Two new optional HealthCheckConfig fields; no existing field number or type changes.
  • The TCP probe writes nothing to the backend.
  • URI validation (CR/LF/NUL/C0) still applies in every mode. The leading / is only required in HTTP mode, the only mode that puts the URI on the wire.

Tests

Test What it covers
test_health_check_tcp_mode_marks_blackholed_and_refused_backends_down Blackhole: full accept queue, so the probe times out. Refused: closed port, so the probe sees the socket error. Both go DOWN. This guards the connect verdict.
test_health_check_tcp_mode_keeps_500_and_404_backends_up Backends that accept but answer 500/404 stay up. This guards the mode switch.
test_health_check_http_mode_accepted_statuses_keep_404_backend_up 200-499 keeps a backend that answers 404 on the probe path up.
test_health_check_legacy_config_marks_404_backend_down A legacy config still accepts only 2xx.
Unit tests in lib/src/health_check.rs Status matching for lists, ranges and any; the 2xx default being replaced; tcp_connect_outcome; http1_interim_responses_are_skipped_for_the_final_status; h2c_interim_headers_are_skipped_for_the_final_status.
Unit tests in command/src/config.rs Range parser and its Display round trip; validation (mode, TCP URI exemption, TCP status refusal, bounds, exclusivity); TOML to AddCluster.
Unit test in command/src/state.rs set_health_check_tcp_mode_with_status_field_rejected.
Unit test in bin/src/cli.rs CLI parsing of the new flags and of both timeouts.

The e2e tests are in e2e/src/tests/health_check_mode_tests.rs. They read the worker's health_check.{success,failure,down} counters and skip the event responses the checker queues on the command channel.

Note: the Blackhole helper duplicates the one in the in-flight #1800 failover branch (e2e/src/tests/backend_failover_tests.rs). Whichever PR lands second should deduplicate it.

Seen red. On main the new tests do not compile, because the fields are absent. I also ran mutation rounds on a git archive copy of this branch:

  1. TCP mode forced back to the HTTP probe: tcp_mode_keeps_500_and_404_backends_up fails.
  2. accepted_statuses ignored: the accepted e2e test and the four accepted_statuses_* unit tests fail.
  3. Exclusivity check removed: the command/src/config.rs health-check tests fail.
  4. tcp_connect_outcome ignores socket errors: the blackholed/refused e2e test and tcp_connect_outcome_reports_established_and_refused fail.
  5. expected_status = 0 accepts any status: the legacy e2e test, test_is_status_healthy_any_2xx and two parse tests fail.
  6. Interim skip removed: both interim tests fail. A decoder rebuilt per h2c block also fails h2c_interim_headers_are_skipped_for_the_final_status (left: Some(false) right: Some(true)): its x-hint header is outside the HPACK static table, so the final block references the dynamic table.
  7. TCP-mode status refusal removed: the state test and the two command/src/config.rs health-check tests fail.

Commands run (all exit 0 on d743a112, after merging main at 3aec7035)

cargo +nightly fmt --all --check
cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings
cargo +1.93.1 test -p sozu-lib --lib --all-features --locked                 # 1578 passed
python3 .github/scripts/check_doc_citations.py --root . --base origin/main

On 4a9290f6, the previous head: sozu-command-lib + sozu tests all passed and the health_check e2e tests passed (10). The full e2e suite passed (592/592) on 9f7d62a4. Neither was rerun on d743a112, which changes only a unit test and docs on this branch, plus the merge of main.

Docs

doc/health_checks.md (modes, parameters, accepted-status syntax, interim responses, TOML case and the UDP TCP_PROBE naming, upgrade warning, --probe-timeout vs global --timeout, list output), doc/configure.md, doc/metrics.md, bin/config.toml, CHANGELOG.md.

…epted HTTP statuses

`HealthCheckConfig` gains a `mode` (proto field 7): `HTTP`, the default
and the previous behaviour, or `TCP`, where a backend passes as soon as
the TCP connection is established within `timeout`. Nothing is sent, the
connection is closed once established, and `uri` and the status fields
are ignored. A platform can then enable health checks on every cluster
to take blackholed backends out of rotation without marking down
applications that answer 3xx, 401, 404 or 500 on a fixed path.

HTTP mode gains `accepted_statuses` (proto field 8, inclusive
`HttpStatusRange` entries; TOML/CLI entries "404", "200-399", "2xx" or
"any", bounds within 100-599). It replaces `expected_status` when set;
setting both a non-zero `expected_status` and a list is refused by
`validate_health_check_config` at every boundary.

`uri` stays a required proto field (may be empty in TCP mode); the TOML
key and `--uri` default to "/". Messages and saved states without the
new fields decode as HTTP mode with no list, so existing configurations
keep their meaning. `sozu cluster health-check set` gains `--mode` and
`--accepted-statuses`; `list` shows the mode and accepted statuses.

The probe timeout flag of `health-check set` becomes `--probe-timeout`:
its `--timeout` shared the clap id of the global `-t/--timeout` command
timeout (u64 against u32), so every `health-check set` invocation
panicked on the downcast before sending anything.

Fixes #1801

Signed-off-by: Florentin Dubois <[email protected]>
…P mode, document upgrades

HTTP probes skip interim 1xx responses (except 101) on HTTP/1.1 and h2c,
with one HPACK decoder for the whole h2c walk, so accepting 1xx or any
never lets a 100 Continue stand in for a final status.

validate_health_check_config refuses a non-zero expected_status or a
non-empty accepted_statuses with mode TCP, which judges no status.

Document that an older worker, an older CLI patching a cluster by
read-modify-write, or an older binary loading a saved state ignores
fields 7 and 8 and runs GET <uri> accepting only 2xx; that --timeout on
health-check set is the global command timeout; the library API break;
the TOML case of mode against the UDP TCP_PROBE; and the RST a banner
backend can see when the probe closes.

Refs #1801

Signed-off-by: Florentin Dubois <[email protected]>
…im blocks

The h2c interim test used `link`, a static-table name, so the final
block never referenced the dynamic table and a decoder rebuilt per block
passed too. `x-hint` is inserted with the interim block and referenced
by the final one.

Document that the 4096-byte response cap covers interim responses, and
that a malformed padded/priority HEADERS frame keeps the probe reading
until EOF or its timeout.

Refs #1801

Signed-off-by: Florentin Dubois <[email protected]>
@FlorentinDUBOIS
FlorentinDUBOIS merged commit 320e86d into main Oct 2, 2026
75 of 78 checks passed
FlorentinDUBOIS added a commit that referenced this pull request Oct 2, 2026
Fixes #1800

## Summary

A backend that accepts no connection (blackholed: SYN dropped, accept queue full) hit `connect_timeout` and the request was answered `504`. The timeout path marked the connection `Disconnecting`, so the dead-backend branch of `Mux::ready_inner`, the only place a connect failure is counted, never saw it. The backend's retry policy was never armed and the load balancer kept picking it.

- **Connect timeout counts as a connect failure.** `Mux::timeout_inner` now flags a still-`Connecting` connection's readiness `ERROR`, the way the kernel flags a refused dial. `Server::timeout` then runs the `ready` pass that only it can trigger (new `ProxySession::needs_ready_pass`, default `false`). That pass reuses the existing dead-backend branch: it counts the failure (`failures`, `retry_policy`, `backend.connections.error`, `backend.down`), closes the connection, and re-links the request through `EndStreamAction::Reconnect`. The request sent no byte, so it is safe to resend. A response timeout on an established connection still answers `504`.
- **A WRITABLE event no longer marks a connecting socket connected.** `SO_ERROR` (`take_error`) is read first, then `getpeername(2)`. An error is a connect failure. `ENOTCONN` means the WRITABLE was raised by Sōzu itself, not by the kernel, so the connection waits for the kernel's completion edge. This fixes a separate defect you can observe on its own: on `main`, a dial from an `http2 = true` cluster to a blackholed backend was marked connected and then hung until `back_timeout`.
- **A synchronous `connect(2)` failure is retried** instead of being answered `503` at once.
- **Each retry skips the backends that already failed for this request** (`Stream::tried_backends`), for every load-balancing policy. The exclusion narrows the candidate set (`BackendList::select_with_key_excluding`). If every selectable backend was already tried, selection falls back to the plain behaviour, fail-open included, so the request retries one of them instead of being refused. A sticky cookie that names a tried backend is not followed.
- **The retry budget is configurable.** `max_connection_attempts` counts every attempt, the first included. It replaces the hard-coded `CONN_RETRIES = 3`, and **the default is now 5**. It can be set:
  - globally: TOML and `ServerConfig` field 29;
  - per cluster: `Cluster` field 23, TOML, `sozu cluster add --max-connection-attempts`, and `sozu cluster connection-attempts set|unset` (query, then re-send with the field changed, like `cluster h2`). A cluster table column shows the value;
  - at runtime on every worker: `sozu connection-attempts set` (`Request.set_max_connection_attempts`, field 62). Like `connection-limit set`, this is not saved.

  Allowed range is `1..=255`. It is validated at config load, on `AddCluster` (main and worker), and on the runtime set. A cluster value wins over the global one, for both HTTP and TCP clusters.

- **Failover is bounded by `front_timeout`.** The frontend's nominal timeout is set only on a request's first link, not on every re-link. The deadline armed then therefore bounds the whole failover, so a request can no longer run for `max_connection_attempts × connect_timeout`. When the deadline expires during failover, the request gets the frontend timeout's existing answer: `504`, with access-log message `client_timeout_during_response`. `doc/configure.md` recommends keeping `connect_timeout` well below `front_timeout / max_connection_attempts`, and explains how back-off grows.
- **Socket error logged.** The socket error read by `take_error()` is logged at `debug!`, the same level as the synchronous-refusal path.

**Status change for alerting:** when every attempted backend is unreachable (connect timeout or refused), the answer is now `503`. A connect timeout used to answer `504`. Requests that arrive during a back-off window can also fail fast with `503`. Operators alerting on `504` rates should watch `503`, `backend.connections.error` and `backend.connect.retries_exhausted` instead. With the default budget at 5, an idempotent request on a stale keep-alive connection can be replayed to up to 4 backends (`n - 1`), against 2 before.

**Coordination:** `Request` field 62 is also used by the open PR #1300. That PR already needs renumbering, so this one keeps 62.

**Library API break:** `sozu_lib::server::CONN_RETRIES` is removed, and new fields are added to `Cluster`, `ServerConfig`, `RequestType`, `FileConfig`, `FileClusterConfig`, `HttpClusterConfig`, `TcpClusterConfig`, `Stream` and `SessionManager`. Upgrade the main process, the workers and the CLI together before setting a per-cluster budget: an older CLI that patches clusters by read-modify-write drops the field.

Docs: `doc/configure.md` (new "Backend connection failover" section, global key, metrics, shard and replay budget text), `doc/configure_cli.md`, `doc/health_checks.md`, `doc/lifetime_of_a_session.md`, `doc/rate-limit-design.md`, `lib/src/protocol/mux/LIFECYCLE.md` §7.3, `bin/config.toml`, and `CHANGELOG.md`.

## Existing tests touched

Two existing tests now call `mark_connected(h1)` in their fixtures: `a_backend_timeout_leaves_no_linked_stream_behind_on_the_close_path` and `a_completed_backend_response_timeout_unlinks_through_end_stream_alone`. Both describe a backend that has already sent response bytes, but their fixture left it `Connecting`. With this change, a `Connecting` connection is treated as a connect timeout. No assertion changed, and neither test encodes the old `504`; they cover the response-timeout arms. An alternative would be to narrow the timeout branch to `Connecting && no linked stream has back.consumed`. I kept the fixture fix instead, because that extra condition cannot be reached in production.

## Tests

New: `e2e/src/tests/backend_failover_tests.rs`, plus `connect_outcome_tests`, `exclusion_tests`, `a_connect_timeout_flags_the_dial_dead_instead_of_answering_504`, the `max_connection_attempts` config tests, and the state validation test.

What each test proves:
- The connect-timeout e2e tests use 3 healthy and 3 blackholed backends with `connect_timeout = 1`. The blackhole is a backlog-0 listener with a full accept queue; `test_blackholed_listener_times_out` checks that it really times out. Every request must answer 200, and the cluster-level `backend.connections.error` must be greater than 0. That counter shows the timeouts are now counted against the backend, which arms its retry policy. It does not measure a drop in how often dead backends are picked.
- The refused-backend e2e tests use a refused/healthy alternation that drives the first request onto three refused backends in a row. The budget raise is what fixes them. The tried set itself is covered by `exclusion_tests`.

## CI fix: leaked mock backend threads

CI on `9bd8bfa6` and `379b4a4e` failed `tests::h2_tests::test_h2_rapid_reset_triggers_goaway` in every cell ("received 0 frames"). The cause was in this PR's test module, not in production code.

**Cause:** `Backends` in `e2e/src/tests/backend_failover_tests.rs` dropped its `AsyncBackend` handles without stopping them. That backend's thread (`e2e/src/mock/async_backend.rs`, the spawn loop) only exits on a stop message, so every dropped handle left a thread spinning for the rest of the test process. That was about two dozen threads, all started before `h2_tests` in name order. On a small CI runner they starved the rapid-reset worker: CI logged its 999 resets over 12 s, in batches of about 17 every 110 ms. Main's CI run took 0.16 s for the same resets, with identical per-stream timings.

**Fix:** `impl Drop for Backends` now stops those backends. The rapid-reset test is unchanged.

**Evidence:** I ran `taskset -c 0 cargo test -p sozu-e2e --locked -- backend_failover tests::h2_tests::test_h2_rapid_reset_triggers_goaway --test-threads=4 --nocapture` before and after the fix.
- Before: about 24 threads were busy during the rapid-reset test (`ps -L`), and the 999 resets took 1.57 s instead of 0.1 s.
- After: no busy leftover threads, and the 999 resets took 0.32 s.
- The full e2e suite dropped from 3098 s to 1963 s.

## CI fix: worker events read as answers

At `dff0285e`, `test_connect_timeout_fails_over_h2` failed in the crypto-openssl cell even though every request got its 200. The test's metrics query read a worker event (`content_type: Some("event")`) in place of its answer. The failover tests make backends fail on purpose, and a backend whose retry policy gives up on it is reported `BACKEND_DOWN` on the same command channel. Reads in these tests now skip events (`read_answer`).

That event's arrival depends on randomized back-off, so I did not reproduce the race locally. After the fix, both connect-timeout tests passed 20 runs out of 20 under `taskset -c 0`, and 20 out of 20 on 2 CPUs loaded with 6 busy processes.

Validation at head `6c7dd668`, after merging origin/main `320e86d6` (#1805; conflicts in `command/src/config.rs` and `doc/health_checks.md` resolved keeping both features):

Verified: `cargo +nightly fmt --all -- --check` -> exit 0
Verified: `cargo +1.93.1 clippy --all-features --all-targets --locked -- -D warnings` -> exit 0
Verified: `cargo test -p sozu-lib --lib --all-features` -> `test result: ok. 1586 passed; 0 failed`
Verified: `cargo test -p sozu-command-lib -p sozu --all-features --locked` -> exit 0, all `test result: ok` (227 command-lib unit tests)
Verified: `cargo test -p sozu-e2e --features opentelemetry,splice,simd -- --test-threads=4` -> `test result: ok. 621 passed; 0 failed`
Verified: `RUSTDOCFLAGS="-D warnings" cargo +1.93.1 doc --no-deps --locked -p sozu-lib -p sozu-command-lib -p sozu` -> exit 0
(An earlier run at `f8d4c18e` had one timing failure under load: `test_h1_chunked_encoding_edge_cases`. That test passed 3 times out of 3 in isolation, and the full `h1_security_tests` module passed with `--test-threads=4`.)
Verified: `python3 .github/scripts/check_doc_citations.py --root . --base origin/main` -> exit 0

Red without the fix:
- New e2e tests on `main` (`dc25d2ff`):
  - `test_connect_timeout_fails_over_h1`/`_h2`: `[200, 504, 200, 504, …]` (12×200, 12×504) and `backend.connections.error: 0`.
  - `test_refused_backends_never_exhaust_attempts_h1`/`_h2`: first request `503`.
  - `test_h2_backend_connect_failure_fails_over_h1`/`_h2`: `[200, 0, 200, 200, 0, …]`, where `0` is no answer within 10 s.
- `test_failover_is_bounded_by_front_timeout_h1`/`_h2` (6 blackholed backends, budget 20, `connect_timeout` 1 s, `front_timeout` 3 s):
  - in a scratch copy of this branch with the per-attempt re-arm restored: no answer within 10 s on both frontends;
  - with the fix: `[504]` after about 3.09 s on both.
- `try_connect_timeout_fails_over` now asserts `backend.connections.error >= 3`, one failure per blackholed backend. Round robin hits each of the six backends in the first six requests, so this is deterministic.
- Budget and unit tests, in scratch copies of this branch with one part of the fix reverted at a time:
  - default set back to 3: `test_default_connection_attempt_budget_is_five` fails (`503`), and so does the config default test;
  - cluster override ignored: `…overrides_global` fails (`503`), and so do the runtime cluster update and the default test's per-cluster `four`;
  - runtime setter disabled: `…changes_at_runtime` fails (`200` where `503` is expected);
  - exclusion, fallback or sticky filter removed: the matching `exclusion_tests` fail;
  - `ENOTCONN` treated as connected: `a_dial_nobody_answers_is_pending` and the H2-backend e2e tests fail;
  - `Connecting` early return removed: `a_connect_timeout_flags_the_dial_dead_instead_of_answering_504` fails;
  - validation removed: the config and state range tests fail.



Signed-off-by: Florentin Dubois <[email protected]>
FlorentinDUBOIS added a commit that referenced this pull request Oct 3, 2026
…1809)

Audit of the docs, `bin/config.toml` and `os-build/config.toml` against everything merged on `main` from 2026-10-01 to 2026-10-03 (43 commits, #1724 through #1808). Most of the new keys were already documented by their own PRs (`max_connection_attempts`, `h2_stream_refusal_percent`, health check `mode`/`accepted_statuses`, the raised flood defaults, the 16 MiB connection window). This PR fixes what was still stale.

| Area | Where | Was | Now |
|---|---|---|---|
| #1806 | `bin/config.toml`, `os-build/config.toml` answer comments | 503 only for "no backend available"; "504 means the backend timed out" | 503 also when every attempt failed; 504 = connected backend silent or frontend timeout while waiting; connect timeout fails over |
| #1806 | `bin/config.toml` `max_connection_attempts` | connect timeout always fails over | a TCP session whose connect times out is closed |
| #1806 | `doc/debugging_strategies.md` | 503 after a circuit breaker of 3 failed connections; ERROR log lines, one that no longer exists | `max_connection_attempts` (default 5), `backend.connect.retries_exhausted`, real TCP log levels and text |
| #1806 | `doc/configure.md` `front_timeout` / `connect_timeout` rows | "inactivity for a request to connect" | time to establish a backend connection; HTTP fails over, TCP closes; H1 failover bound by `front_timeout` |
| #1806 | `doc/configure.md` `client_timeout_during_response`, `backend_timeout`, `http.503.errors` | "connection-level slowness", "circuit breaker" | failover case included; established connection only; attempt budget |
| #1806 | `LIFECYCLE.md` backend timer | 504 for any linked stream | established connection only |
| #1806 | `cli.rs` help, `doc/configure_cli.md` | "answered 503" | "or a TCP session is closed" |
| #1756 | `doc/configure.md` flood metrics | RST lifetime rows described as absolute ceilings; no `window_update_stream0_window` row | floor-and-ratio semantics; row added |
| #1756/#1798 | `doc/architecture.md`, `doc/h2_mux_internals.md` | 6 / 13 `H2FloodConfig` thresholds | 14, with `h2_stream_refusal_percent` |
| #1756 | `doc/configure_admin_ops.md` | "halve" example 50/25 (old defaults); H2 knobs HTTPS only | 1000/500; HTTP and HTTPS; `h2.flood.stream_refused` |
| #1752 | `doc/configure.md` glitch tuning | "1 MiB window ... about 64" frames | 64 KiB stream window, about four |
| #1805 | `doc/health_checks.md` | `remove` resets backends to healthy; DOWN logs an error; `load_balancing.rs::BackendList::healthy` | backends keep their last state (see note); warning; `BackendList::select_tiers` in `backends.rs` |
| #1805 | `doc/metrics.md` | health-check counters "per cluster" | unlabelled |
| #1805 | `doc/configure_cli.md` | no health-check section | short section, `--mode`, `--probe-timeout` vs global `--timeout` |
| #1746 | `cli.rs` `--load-balancing-policy`, `bin/config.toml`, proto comment | HRW/MAGLEV key = UDP flow key | UDP affinity key (source IP, or IP and port) |
| UDP | `doc/configure.md` | hot upgrade drains flows bounded by idle timeout; `udp.flows.evicted` reasons | soft-stop closes flows at once; listener removal/soft-stop/abort added |
| #1770 | `doc/udp_simulation.md` | no per-source limits | in reconfig storms and the invariant list |
| #1743 | `doc/lifetime_of_a_session.md` | keep-alive backend always reused | unless its backend was removed |
| older | `command.proto` update messages | `h2_stream_shrink_ratio >= 1` | `>= 2`, as validated in `state.rs` |
| #1806 | e2e shuffle-sharding doc comment | "three connection attempts" | `max_connection_attempts` (5 by default) |

Reported here, not changed in this PR:
- `sozu cluster health-check remove` does not reset backends a probe marked DOWN (`remove_health_check_state` skips the reset that `set_health_check_config(None)` does), so they stay out of rotation until the cluster is added again. The doc now describes this. It looks like a code bug.
- `sozu top`'s H2 pane reads `h2.flood.violation.{rapid_reset,made_you_reset,ping,settings,priority,continuation}`, which the detector never emits (it emits `rst_stream_pre_response_lifetime`, `ping_window`, ...). Only `glitch_window` matches, and `h2.flood.stream_refused` is not shown.
- `h2_flood_detector.rs` comments still refer to a 1 MiB connection window, and the `h2_stream_idle_timeout_seconds` proto comment says "Default: 30" where the value inherits `back_timeout`.
- `connections.rejected_per_cluster_ip` is documented as also counting TCP rejections; only the HTTP 429 path increments it.

Validation:
- `sozu config check` passes on `bin/config.toml`, on a copy with every commented key under review uncommented (global and cluster `max_connection_attempts`, the H2 block, the health check block), and on `os-build/config.toml` with local state/socket paths. Negative controls (`max_connection_attempts = 0`; `expected_status = 200` next to `accepted_statuses`) are rejected.
- `cargo +1.93.1 test -p sozu-command-lib --all-features --locked`: 235 passed.
- `cargo +1.93.1 test -p sozu --bin sozu --locked`: 124 passed (including the `--load-balancing-policy` help tests).
- `cargo +nightly fmt --all --check` and `python3 .github/scripts/check_doc_citations.py --root . --base origin/main` are clean.



Signed-off-by: Florentin Dubois <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(health-check): add a TCP connect probe mode and configurable accepted HTTP statuses

1 participant