Skip to content

-max-queries does not stop memory growth in recursive mode (visited map keeps growing after the cap) #51

Closed

Description

@TMHSDigital

Why it matters

-max-queries is the safety valve that makes large recursive scans viable. After the cap is reached, the dispatcher still accepts and records every child name, so memory and CPU keep growing in proportion to found × wordlist.

Evidence

  • internal/scan/runner.go:347-355: visited[j.domain] = true runs before the cap check.
  • internal/scan/runner.go:520-527: each found parent pushes len(Entries) children one at a time through the unbuffered enqueue channel.
  • Scenario: a 100k wordlist with 1,000 found names produces about 100M strings in visited (several GB) and about 100M channel handoffs, after the scan has already stopped sending queries.

Suggested approach

  • Expose an atomic "cap reached" flag; workers check it and stop enqueueing children.
  • The dispatcher counts skipped names without storing them.

Done when

A test with -recursive -max-queries N shows visited size bounded by about N plus in-flight jobs.

Activity

  1. added
    bug
    priority: medium
    performance
    area: scan
    on Oct 4, 2026
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: scanbugperformancepriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions