Skip to content

Glob tool hangs indefinitely on broad directory patterns #636

Description

@anandgupta42

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions