Skip to content

Reliability guard can only abort or warn; add an opt-in adaptive back-off #220

Closed

Description

@TMHSDigital

Summary

When more than 20% of lookups fail, the reliability guard either aborts the scan (exit 1) or, with -no-abort, keeps going at the same speed and only warns. Its own message says the likely cause is rate-limiting at the current concurrency and rate, but it never acts on that. An opt-in "back off and continue" mode would turn many aborted runs into complete ones.

Where

  • internal/scan/runner.go:817-841 (checkReliability): one-shot guardOnce; abort or warn, nothing in between
  • internal/scan/runner.go:20-21: fixed reliabilityMinJobs = 200, reliabilityFailPercent = 20
  • internal/dns/ratelimit.go:22 (NewRateLimiter): rate fixed at construction

Proposal

  • Add -auto-rate (opt-in at first). When the failure rate over a sliding window (e.g. the last 200 lookups) passes the threshold, halve the effective rate (starting from the observed qps if -rate is 0), log a notice, and keep going. Once the window is healthy again, raise it step by step up to the configured cap.
  • Let RateLimiter change its rate safely while running (SetRate).
  • The guard aborts only after N back-offs fail to bring the window under the threshold, or below a floor rate.
  • Report back-offs and the final rate in -stats and the summary.

Who benefits

Users on public resolvers or home networks, CI monitoring jobs (fewer flaky exit-1 runs), and people who don't know what -rate to choose.

Trade-offs / open questions

  • Should failed names from the bad window be re-queued? (Pairs well with an inconclusive-names retry pass.)
  • Sliding-window state should stay lock-free on the hot path.
  • With -r, back off per resolver (-rate-per-resolver) before the global rate?

Acceptance criteria

  • RateLimiter supports changing its rate while running, with tests
  • -auto-rate backs off and recovers in a internal/dnstest scenario with injected timeouts
  • Default behavior unchanged without the flag
  • Back-offs reported in -stats and the summary; docs and CHANGELOG updated

Getting started


Filed by repo-audit/feature-ideas at 3fd0128. Severity: medium. Effort: L. audit-key: enhancement|internal/scan/runner.go|checkReliability

Activity

  1. added
    enhancement
    area: scan
    severity: medium
    on Nov 11, 2026
  2. TMHSDigital commented on Nov 11, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 41b2434.

    • How it works: -auto-rate (Config.AutoRate) judges the last 200 lookups.
      • Over 20% failed: it halves the rate (from the achieved rate when -rate is 0) and emits a rate notice.
      • A full healthy window (5% or fewer failures): it raises the rate by a quarter, up to where it first backed off.
      • After 6 back-offs, or at 5 queries/s, the reliability guard applies as before.
    • New fields: RateLimiter gains SetRate/Rate. The report gains rate_backoffs and final_rate.
    • Default: without the flag nothing changes.
    • Open questions:

    Verified with:

    • controller tests (TestAutoRateBacksOffAndRecovers, TestAutoRateGivesUp, TestAutoRateUnlimitedStart)
    • TestSetRate
    • TestRunAutoRateKeepsGoing: the same burst of timeouts aborts a plain scan, while the AutoRate scan finishes with back-offs counted. It ran 5 times under -race with no wall-clock upper bounds.
    • the full go test ./..., -race, and golangci-lint run (0 issues)
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

    area: scanenhancementseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions