Skip to content

[Bug] FD Leak: skills watcher ignores .venv/, causing spawn EBADF #9481

@ChanDava

Description

@ChanDava

Bug Description

OpenClaw's skills watcher (chokidar) does not ignore .venv/ and pycache/ directories by default, causing file descriptor exhaustion (FD leak) when skills contain Python virtual environments.

Symptoms

  • spawn EBADF error when using exec tool
  • Gateway becomes unresponsive
  • FD count explodes to 17,000+

Root Cause

In dist/loader-BrK9xPUo.js, the DEFAULT_SKILLS_WATCH_IGNORED array only excludes:

const DEFAULT_SKILLS_WATCH_IGNORED = [
  /(^|[\/\])\.git([\/\]|$)/,
  /(^|[\/\])node_modules([\/\]|$)/,
  /(^|[\/\])dist([\/\]|$)/,
];

Missing patterns:

  • .venv/ - Python venv (10,000+ files)
  • pycache/ - Python cache
  • browser_data/ - Browser cache

Impact

When a skill with Python venv is in workspace/skills/:

  1. Chokidar watches ~11,000 files in .venv/
  2. FD count hits 17,784 (exceeds ulimit 4,864)
  3. child_process.spawn() fails with EBADF
  4. Gateway exec tool broken

Suggested Fix

const DEFAULT_SKILLS_WATCH_IGNORED = [
  /(^|[\/\])\.git([\/\]|$)/,
  /(^|[\/\])node_modules([\/\]|$)/,
  /(^|[\/\])dist([\/\]|$)/,
  /(^|[\/\])\.venv([\/\]|$)/,
  /(^|[\/\])__pycache__([\/\]|$)/,
  /(^|[\/\])browser_data([\/\]|$)/,
];

Severity: High
Type: Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    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