altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

Glob tool hangs indefinitely on broad directory patterns

Open anandgupta42 opened this issue 8 months ago • 2 comments

Description

When running from the home directory, calling Glob "**/dbt_project.yml" hangs indefinitely (1+ hours with no response). The recursive glob pattern scans the entire filesystem tree from the home directory without any timeout or scope limit.

Reported by user FrankTub in #623 (external report).

Root Cause

Ripgrep.files() is spawned with --files --hidden from a broad directory with no timeout. The --hidden flag makes it worse (scans .cache, .npm, .local, etc.). Home directory isn't a git repo, so no .gitignore helps.

Fix

  1. Add a 30-second timeout using abortAfter utility
  2. Return partial results on timeout with a helpful message guiding users to narrow their search
  3. Kill the rg child process immediately on early exit (100-file limit or timeout) via localAbort controller
  4. Properly distinguish timeout errors from real errors (ENOENT, permissions) — only swallow AbortError from timeout signal

Upstream Context

Upstream has related issues (#18954 infinite loops, #5220 100% CPU) but no merged fixes yet.

anandgupta42 avatar Apr 04 '26 15:04 anandgupta42

Also experiencing this, great to see it is already fixed!

FrankTub avatar Apr 04 '26 17:04 FrankTub

Resolved in v0.5.18.

anandgupta42 avatar Apr 04 '26 19:04 anandgupta42