Skip to content

Codex Desktop: unbounded git process spawning → OOM when the workspace is on a slow / change-notification-limited filesystem (e.g. WSL /mnt drvfs) #26904

Open

Description

@FadulSikderUTA

Summary

When a workspace folder lives on a filesystem where file operations are slow and change-notifications are unreliable, Codex Desktop appears to keep re-checking the folder's git state and spawning git processes without any upper bound. They pile up faster than they finish, memory climbs steadily, and the machine eventually runs out of memory and the app is OOM-killed.

(I'm describing observed behavior — I don't have the desktop app source.) This appears to be in the same git-repo-watcher / inotify-ENOSPC family as #23574 (VS Code extension allocating ~1M inotify watches on Linux) and #23191 (git-repo-watcher ENOSPC when $HOME is a large repo), and the runaway-child-process family of #24347. But it looks distinct in three ways: this is the Desktop app (not the VS Code extension or CLI); the symptom is unbounded git process spawning (not just inotify watch allocation); and the trigger is a slow / change-notification-limited filesystem (WSL /mnt drvfs), which I haven't seen reported.

Environment

  • Codex Desktop app v42.1.0 (same packaged app bundle as macOS/Windows; here running on Linux).
  • Codex CLI 0.137.0 is installed separately and is not involved — this is the Desktop app's own behavior (the CLI is a separate binary that has no equivalent file-watcher).
  • WSL2, Ubuntu 24.04, kernel 6.6.87.
  • Workspace on /mnt/c/... (drvfs) — the Windows drive mounted into Linux: slow for many small operations, with limited/unreliable inotify support.
  • fs.inotify.max_user_instances = 128 (Linux default).
  • The workspace folder was not yet a git repository (so the app's "watch for git init" path was active).

Observed behavior (evidence)

  • Within ~3 minutes of opening the workspace, the number of live git processes climbed steadily — roughly +500 every 30 seconds, monotonically — reaching ~62,000 simultaneous git processes.
  • Resident memory rose ~1 GB/min in lockstep; once RAM + swap were exhausted the OS OOM-killer fired and took the whole WSL VM down.
  • The app log repeatedly showed the git-init watcher failing on the workspace root:
    ENOSPC: System limit for number of file watchers reached, watch '/mnt/c/.../<workspace>', then re-attempting.
  • Adding swap only delayed the crash; the process count kept climbing — i.e. an unbounded spawn, not a transient spike.

Why this generalizes

Nothing here is fundamentally Windows/WSL specific. Any workspace on a slow or notification-limited filesystem — network mounts (SMB/NFS), some FUSE filesystems, container bind-mounts — could plausibly trip the same loop. The pattern is: the change-watch keeps failing and re-arming, and each cycle launches git, which on a slow FS doesn't return promptly, so spawns accumulate without bound.

Suggested direction (not prescriptive)

  • Put an upper bound / backoff on the watch-retry + git-state-resolution cycle.
  • De-duplicate or serialize concurrent git lookups for the same workspace (don't re-spawn while one is in flight).
  • Detect slow/remote filesystems and degrade gracefully (bounded polling instead of unbounded spawn), or surface a one-time warning.

Reproduction

  1. WSL2 Ubuntu, default fs.inotify.max_user_instances=128.
  2. Put a folder under /mnt/c/... (it need not be a git repo).
  3. Open it as the workspace in Codex Desktop.
  4. watch -n1 'ps -e | wc -l; free -m | grep Mem' → process count and memory climb without bound until OOM.

Activity

  1. added
    bugSomething isn't working
    appIssues related to the Codex desktop app
    windows-osIssues related to Codex on Windows systems
    on Jun 7, 2026
  2. tv0z0c commented on Jun 8, 2026

    @tv0z0c

    Removed: this was posted from the wrong account.

  3. pussikill commented on Jun 8, 2026

    @pussikill

    I inspected the installed Desktop bundle to narrow down where this loop likely lives.

    The public Rust checkout does not appear to contain the owner of this retry loop: searching the repo for git-init-watcher, git-repo-watcher, stable-metadata, watch-repo, unwatch-repo, and watchForGitInit returns no Rust/source matches for the Desktop worker logic.

    In the packaged Desktop worker, the relevant path appears to be the JS-side git worker:

    • UI query code calls the git worker method stable-metadata with watchForGitInit.
    • If metadata is missing and watchForGitInit is true, the worker creates a git-init-watcher.
    • The repo watcher path creates git-repo-watcher, registers watch-repo / unwatch-repo, and retries failed remote watch sessions on a fixed 1s timer.
    • The worker bridges to the app-server through fs-watch and process-start, so the Rust app-server looks like the provider of filesystem watch/process RPC rather than the owner of the git retry policy.

    That matches the reproduction here: on a slow or watch-limited filesystem, watch setup can fail or churn while stable-metadata / git-state resolution keeps spawning git work faster than it can finish.

    The fix likely belongs in the Desktop git worker rather than the CLI/app-server Rust code:

    • serialize/dedupe stable-metadata and git-state lookups per (host, cwd/root) while one is already in flight;
    • add exponential backoff and an upper bound for failed watchForGitInit / watch-repo retries;
    • treat ENOSPC / watch-limit errors as a degraded mode, not an immediate tight retry path;
    • optionally suppress git-init watching for known slow mounts like WSL /mnt/* and rely on bounded polling or explicit refresh.
  4. lordmauve commented on Jun 20, 2026

    @lordmauve

    I found a workaround: configure the Codex Desktop app to use workspaces on a native Linux FS via \\wsl.localhost\ UNC paths e.g. \\wsl.localhost\Ubuntu-24.04\home\lordmauve\someproject.

    It looks like this works fine: codex in WSL has the right CWD, I can browse files in the Codex Desktop app on Windows, and CPU usage is near zero.

  5. weathon commented on Sep 9, 2026

    @weathon

    Yes, I was running codex on my server with 2TB of RAM, and codex spawn a lot of git processes that used all 2TB and somehow killed the nvidia driver and now I cannot use my GPU

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingperformancewindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions