Skip to content

Preserve backend identity and incarnation across removal and health-check completion #1821

Closed

Description

@FlorentinDUBOIS

AddBackend and ConfigState identify a backend by (backend_id, address) and allow two ids at one address, but several worker paths discard that identity:

  • targeted removal passes only the address and removes every same-address entry (server, backend list);
  • HTTP/TCP health completion captures backend_id but resolves the live object by address (completion);
  • UDP health completion does the same (record).

Observed consequences at the unchanged production blobs:

  1. Removing id A at a shared address returns OK, but id B disappears from the worker datapath. The E2E reproduced loss of routing to B; the divergence from ConfigState query surfaces is established by source inspection.
  2. A failed UDP probe for B marks A DOWN and logs B.
  3. A health result started for a removed backend can complete after the same id/address is re-added and mutate the replacement incarnation. The worker loop can process remove/add commands before the health poll (event loop), and backend removal does not cancel that probe.

Focused tests prepared during the audit (not yet published on main):

CARGO_BUILD_JOBS=4 mise exec [email protected] -- cargo test -p sozu-e2e --locked tests::remove_cluster_tests::test_removing_one_backend_id_keeps_same_address_sibling -- --exact --nocapture --test-threads=1
CARGO_BUILD_JOBS=4 mise exec [email protected] -- cargo test -p sozu-lib --lib --locked health_check::tests::late_result_after_remove_and_readd_same_identity_does_not_mutate_replacement -- --exact --nocapture
CARGO_BUILD_JOBS=4 mise exec [email protected] -- cargo test -p sozu-lib --lib --locked udp::health::tests::probe_result_updates_the_backend_id_that_was_probed -- --exact --nocapture

All three are red on the audited implementation. The first executes the real command and routing path; the latter two isolate the result sinks.

Acceptance criteria:

  • runtime removal and ConfigState/query surfaces use one explicit identity contract;
  • results target the exact backend id, never the first sibling at an address;
  • an in-flight result is bound to an opaque backend incarnation, or is cancelled on removal, so remove/re-add cannot mutate the replacement;
  • same-address siblings, removal/re-add, HTTP/TCP health and UDP health all have regressions; RemoveCluster still removes the whole cluster.

Evidence scope: runtime checks used 8ed38435c6e80dc374de421116d8b145f1e5ce6a; the relevant production paths were independently checked at bd19a78e2831fa9b3bc099eff96359f1bd457958 on 2026-10-03. This issue tracks lifecycle behavior and regression coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions