Skip to content

The UDP banned-IPs metric counts clients that are not banned #2505

Closed

Description

@josecelano

Found while planning the udp-core banning tests in #1348 (EPIC #1347).

Goal

Make the "banned IPs" metric (udp_tracker_server_ips_banned_total in Prometheus, udp_banned_ips_total in the REST stats) report what its name and descriptions say, and keep it correct after the periodic ban reset.

Bug

BanService::get_banned_ips_total() in udp-core returns the number of IPs with at least one invalid connection ID, not the number of IPs whose count exceeds max_connection_id_errors_per_ip (which is what is_banned uses). The udp-server banning handler publishes that value to the gauge after every connection-cookie error, and the REST stats read the same gauge. Separately, the periodic ban reset clears the counters but never updates the gauge, so after a reset it keeps reporting the old total until the next invalid connection ID arrives.

Reproduced on develop at 1c5939c76 against the running tracker (limit 10, strict validation): one invalid connection ID from each of three IPs plus 11 from a fourth IP made the REST JSON stats, the REST Prometheus stats, and the Prometheus metrics all report 4 banned IPs. Only the fourth IP was actually banned (its next request was dropped and udp_tracker_server_requests_banned_total was 1); the other three were still served.

Impact: operators see an inflated and, after a reset, stale "banned IPs" count. Ban enforcement itself is correct.

Decisions

Acceptance criteria

  • AC1: The banned-IPs total counts only IPs whose error count exceeds the limit, in both strict and disabled mode.
  • AC2: After a ban reset, the banned total and the published gauge report the new value.
  • AC3: The method, metric, udp-server helper, and REST field descriptions match the behavior, including the disabled-mode meaning.
  • AC4: The BanningStats trait and BanService::last_connection_id_errors_reset are removed.
  • AC5: The udp_ban_service benchmark is recorded before and after the change, with no regression on increase_counter or is_banned.
  • AC6: The reproduction is repeated after the fix and recorded.
  • linter all exits with code 0
  • Relevant tests pass
  • Manual verification scenarios are executed and documented in issue-local manual-verification-evidence.md
  • Acceptance criteria are re-reviewed after implementation and reflect actual behavior

Specification: docs/issues/open/2505-udp-banned-ips-metric/ISSUE.md (added by the spec-only PR), with the reproduction evidence in the same folder.

Activity

  1. added
    Bug
    on Oct 13, 2026
  2. added 7 commits that reference this issue on Oct 13, 2026
  3. self-assigned this
    on Oct 13, 2026
  4. added theissue type on Oct 13, 2026
  5. added 5 commits that reference this issue on Oct 13, 2026
  6. 101 remaining items

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

Metadata

Metadata

Assignees

Labels

Bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions