Repository navigation
Description
Summary
The engine keeps the name of every timed-out, refused or failed lookup until the scan ends, whether or not -retry-inconclusive or -inconclusive is set. Under -no-abort against a failing resolver that grows with the wordlist (about 1 GB at 10M candidates).
Where
internal/scan/runner.go:233-248internal/scan/runner.go:886-889internal/scan/runner.go:651internal/scan/runner.go:261-270main_session.go:759-771main_resume.go:308
Details
processJob records every timeout, refusal and failure unconditionally: st.add(outcome); if inconclusive(outcome) { s.pending.add(j, outcome) } (runner.go:886-889). pendingList.add appends a pendingLookup{j job; outcome} (40 bytes: a 16-byte string header, two ints, one int outcome) and so keeps the candidate's name string alive (a 32 to 48 byte allocation that would otherwise be garbage once the job ends). The list is only drained by retryPending, which runs only if cfg.RetryInconclusive (runner.go:639-641). At the end snap.Inconclusive = st.pending.names() (runner.go:651) builds a second []string (16 bytes per name) while the list is still referenced, and sorts it. In the CLI the only readers are inconclusiveNames, called only when -inconclusive <file> is set (main_session.go:806-807), and the resume state; otherwise the list sits in s.results[i].final.Stats for every target until the process exits, and mergeStats copies it again on resume (main_resume.go:308).
Impact
About 72 to 90 bytes retained per failed lookup during the scan, about 110 to 130 bytes at the peak when names() runs, and 48 bytes per name kept afterwards for the rest of a -dL run. With the reliability guard on, failures can reach 20 percent of the candidates before it aborts (runner.go:1063), so a 5M-line wordlist can hold 1M names: roughly 100 MB peak, about half of what the wordlist itself costs. With -no-abort, or under -auto-rate while the controller has not given up (runner.go:1058-1060), there is no bound: a 10M-candidate scan against a resolver that refuses or times out everything holds about 1 GB, plus an O(F log F) sort of F names, for a list nobody asked for. Hurts from roughly 1M failed lookups.
Steps to reproduce
subenum -no-abort -w <multi-million-line list> -dns-server <address that drops or refuses> example.com (hermetically: a local dnsserver handler returning Refused for every name, or the resolveHook used by the scan tests returning OutcomeRefused); watch heap grow linearly with processed candidates although neither -retry-inconclusive nor -inconclusive is set.
Suggested fix
Collect names only when something will read them: add a Config field (for example ListInconclusive) that the CLI sets when -inconclusive or -retry-inconclusive is given and that pkg/subenum keeps on by default or exposes, since Stats.Inconclusive is documented there (pkg/subenum/subenum.go:270-273); otherwise only count. Independently, shrink the entry: for depth-1 jobs store the root index (4 to 8 bytes) and rebuild Entries[root] + "." + Domain in names(), keeping the full name only for recursive children; and release pending.items before building the sorted slice.
Notes
Related: #217 (introduced the list and the retry pass).
Acceptance criteria
- Names are collected only when a consumer asked for them (retry pass,
-inconclusive, library callers that readStats.Inconclusive) - Counts are unchanged when the list is not collected
- A benchmark or test shows heap does not grow with failed lookups when the list is off
Getting started
- Relevant files:
internal/scan/runner.go,main_session.go,main_resume.go - How to run tests:
make test(orgo test ./...). Tests must stay hermetic: use-simulate,-simulate-zoneor the local DNS test server, never a live domain. - Related docs:
docs/DEVELOPER_GUIDE.md,docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at d0c56f0. Severity: medium. Effort: S. audit-key: performance|internal/scan/runner.go|pendingList
Activity
TMHSDigital commentedon Nov 15, 2026
Fixed in 654f974.
The engine now keeps the list of inconclusive names only when something will read it:
-inconclusive <file>or the-retry-inconclusivepass (which drops the list once it has taken it). A wordlist entry is stored as its index rather than its name. The counts in the report are unchanged, andpkg/subenumstill fillsStats.Inconclusivefor library callers.Verified with three new tests in
internal/scan/inconclusive_list_test.go, including a heap comparison: a 100,000-name scan where every lookup is refused now stays within 1 MB of one where every name is NXDOMAIN (with collection forced on it was 7.4 MB against 3.7 MB).go test ./...andgolangci-lint runpass.Two differences from the suggestion: the CLI does not ask for the list under
-retry-inconclusivealone, since nothing reads the final list then, and the library has no opt-out. One side effect: the-resumestate file holds the names only when-inconclusivewas given.Keep the inconclusive-name list only when something reads it (TMHSDig…