Skip to content

perf: bound concurrent file work with a worker pool#89

Open
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:perf/bounded-workers-issue-7-v2
Open

perf: bound concurrent file work with a worker pool#89
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:perf/bounded-workers-issue-7-v2

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 30, 2026

Fixes #7

Made with Cursor

Limit in-flight HandleFile goroutines to GOMAXPROCS*2 (clamped 4–32)
so large directories do not exhaust file descriptors or memory.

Fixes dolph#7
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7eeb76163a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread find_replace.go
fr.errs.add(err)
continue
}
fr.acquireWorker()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid holding worker slots across recursive walks

When the tree contains a path deeper than workerLimit() (or a directory with workerLimit() sibling directories that each need to descend), every directory goroutine keeps its slot until HandleFile returns, then WalkDir tries to acquire another slot for the child before any ancestor can release. At that point all slots can be held by goroutines blocked in recursive WalkDir, so the traversal hangs indefinitely instead of finishing.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unbounded goroutine fan-out exhausts file descriptors and memory on large trees

1 participant