Skip to content

bug: File Descriptor Exhaustion #27

@akramcodez

Description

@akramcodez

Description

The read-many-files tool processes all matched files concurrently without any concurrency limits.

// packages/core/src/tools/read-many-files.ts
// No concurrency limit
const results = await Promise.allSettled(fileProcessingPromises);

Impact

  • Crashes with EMFILE: too many open files on large directories (e.g., node_modules)
  • Potential denial of service due to OS file descriptor exhaustion
  • Unable to scan full project trees reliably

Potential Fix

Introduce a concurrency limit using a p-limit wrapper (e.g., max 20 concurrent operations) to respect OS limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions