Skip to content

TestPoolBenchesDeadResolver is flaky (about 7% failure rate) #253

Closed

Description

@TMHSDigital

Summary

TestPoolBenchesDeadResolver is flaky. Run alone with -count=40 it failed 3 times (about 7.5%), and it also failed once in a full go test ./... run.

Where

  • internal/scan/pool_test.go:186-215
  • internal/scan/runner.go:631-641 (preflight against the trusted resolver)

Details

There are two failure modes:

  1. The preflight against the trusted resolver times out (resolver 127.0.0.1:NNNNN failed preflight ... timeout after 2 attempt(s)). The test sets Timeout to 50 ms with Attempts: 2, which a busy loopback server can miss.
  2. The stats.NXDomain != 80 assertion fails with Timeout:1..5, because both attempts for a name can land on the dead member before it is benched.

Impact

CI runs this test on Ubuntu (with -race), macOS and Windows without retries, so it causes false red builds. It is the same class of problem as #234 and #235.

Steps to reproduce

go test -count=40 -run TestPoolBenchesDeadResolver ./internal/scan/

Suggested fix

Give the trusted resolver and the preflight a generous timeout (at least 250 ms) while keeping the dead member's 50 ms. Or assert NXDomain + Timeout == 80 with a small timeout ceiling. Keep the assertions that the dead member gets benched and receives no more than 40 lookups.

Acceptance criteria

  • -count=200 passes locally on Windows and Linux.

Getting started

  • Relevant files: internal/scan/pool_test.go
  • How to run tests: go test -count=200 -run TestPoolBenchesDeadResolver ./internal/scan/
  • Related docs: docs/DEVELOPER_GUIDE.md

Related: #234, #235


Filed by repo-audit/full-audit at 3f671b2. Severity: medium. Effort: S. audit-key: testing|internal/scan/pool_test.go|TestPoolBenchesDeadResolver

Activity

  1. added
    good first issue
    testing
    severity: medium
    on Nov 14, 2026
  2. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 7d18b44: the test's per-lookup timeout (trusted preflight and pool) goes from 50ms to 250ms. Verified with go test -count=60 -run TestPoolBenchesDeadResolver ./internal/scan/: 60/60 pass (about 1.5s per run); 500ms also passed 60/60 but doubled the runtime.

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

    good first issueseverity: mediumtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions