orca icon indicating copy to clipboard operation
orca copied to clipboard

[Other]: WSL resource usage spikes

Open kenkenken123 opened this issue 4 months ago • 7 comments

Details

After I start Orca, the CPU and disk usage of my Windows WSL (the vmmemwsl process) spikes from time to time. I am not running any programs in WSL myself.

kenkenken123 avatar Jul 16 '26 03:07 kenkenken123

I have Orca installed in the Windows environment, and I also have WSL set up. Whenever I open Orca, the WSL process occasionally consumes a lot of system resources; things return to normal once I close it.

kenkenken123 avatar Jul 16 '26 03:07 kenkenken123

Agent reproduction package (Windows orchestration 2026-07-16)

Host context: Windows 11 / Orca 1.4.143.0 / repo path used: docs/bug-reproductions/
Labels applied: see issue labels (has_repro or cannot_repro).
Security: Do not run user-uploaded binaries from issue attachments. Recreate fixtures from the steps/scripts below.


Issue 8941 — WSL resource usage spikes

Status: repro_confirmed (observational under Orca load)
Host: Windows 11, Orca 1.4.143 running
Label: has_repro
Note: Issue type is [Other] (not labeled bug upstream)

Summary

Reporter: after starting Orca, WSL (vmmemWSL) CPU/disk spikes intermittently even with no user programs in WSL; settles after closing Orca.

What we observed (2026-07-16)

With Orca running (multiple Orca processes + orca-terminal-daemon):

Process Count Working set (approx)
vmmemWSL 1 ~632 MB
wsl.exe 74 ~786 MB total
wslhost 39 ~473 MB total
wslservice 1 ~27 MB
wslrelay 1 ~8 MB

Functional impact:

# Hung >15s (job timeout)
wsl -d Ubuntu -- echo ok

wsl -l -v still shows Ubuntu Running. So the VM is up, but guest command execution is wedged under a storm of wsl.exe clients — consistent with Orca (and/or other tools) spawning many concurrent WSL probes (agent detection, hooks, path checks, git, etc.).

Repro (another agent)

# With Orca open and at least one WSL-touching feature used:
Get-Process vmmem*,wsl*,wslhost* |
  Group-Object Name |
  ForEach-Object {
    [pscustomobject]@{
      Name = $_.Name
      Count = $_.Count
      WsMB = [math]::Round(($_.Group | Measure-Object WorkingSet64 -Sum).Sum/1MB,1)
    }
  }

$job = Start-Job { wsl -d Ubuntu -- echo ok }
Wait-Job $job -Timeout 15
# If still Running → hung (document). Receive-Job / Stop-Job as needed.

Compare counts with Orca fully quit (optional second sample).

Evidence

  • docs/bug-reproductions/evidence/8941-*.json
  • Live process snapshot during investigation (74× wsl.exe)
  • Secondary impact: blocked WSL repros for #8269, #7563, #8475

Expected vs actual

Expected Modest WSL footprint when idle; wsl -d … -- cmd returns quickly
Actual Dozens of wsl/wslhost processes; hung guest commands; elevated vmmemWSL

Fix hint

  • Bound concurrent wsl.exe spawns (shared queue / single-flight for preflight, agent detect, hooks)
  • Prefer long-lived WSL sessions / relay over per-call wsl.exe
  • Timeouts already exist in agent detection; ensure failed probes do not leave orphaned wsl.exe children

How another agent should use this

  1. Read this comment fully (status, expected vs actual, blockers).
  2. If a script is included above, copy it to a temp file and run it on a Windows 11 host with Orca installed (prefer production install under %LOCALAPPDATA%\Programs\orca).
  3. Capture evidence (CLI --json, screenshots, logs) under a local folder; optionally comment results back here.
  4. If status is cannot_repro / needs_setup, satisfy the listed prerequisites first, then re-attempt and flip labels: remove cannot_repro, add has_repro when conclusive.

OrcaWin avatar Jul 17 '26 00:07 OrcaWin

I have found in my daily use that if I open WSL with a terminal, there will be no indirect resource surge I feel that the direction can be determined by whether ORCA regularly calls WSL. If WSL is not turned on for a long time, there may be a situation where continuous startup leads to resource utilization

kenkenken123 avatar Jul 23 '26 08:07 kenkenken123

Do you have a good solution? Why is WSL being enabled?

bfzha avatar Jul 24 '26 04:07 bfzha

This is not a good solution, it's just temporary Because I am not sure about the specific reasons, it may require official investigation I just provided an idea

kenkenken123 avatar Jul 24 '26 06:07 kenkenken123

Root cause confirmed: it's the GitLab glab auth status known-host probe falling back to WSL when host glab.exe is missing.

I hit the same thing on Orca 1.4.161 (Windows). Sampling wsl.exe spawns over ~2 min while interacting with Orca, parented to Orca.exe, every single spawn was the same command:

wsl.exe -d Ubuntu_24_04 -- bash -c "'glab' 'auth' 'status'"

So this isn't agent detection / hooks / generic git — it's the GitLab integration calling cwd-less glab auth status to discover known GitLab hosts. When host glab returns ENOENT, the shared runner auto-resolves the default WSL distro and retries through wsl.exe, even when no worktree is a WSL worktree and GitLab is unused. Each probe wakes the distro; WSL2's vmIdleTimeout shuts it back down; rinse and repeat → the intermittent vmmemWSL CPU/disk spikes the OP described. This matches the symptom in the OP's follow-up: keeping a WSL terminal open stops the spikes, because the distro is already awake so the probe is cheap.

This is the same root cause already partially addressed by #7967 (kept the global diagnoseAuth diagnostic on the host) and #9476 (bounded + coalesced the known-host probe with a 10s deadline). But #9476 only throttles its own probes; it does not retroactively clean up old Orca sessions' hung wsl.exe and the probe still fires (just bounded), so WSL still gets woken on a fresh Orca 1.4.161. #9476's own notes say live verification was blocked by 126 leftover hung matching processes.

Workarounds that actually stop it (verified on 1.4.161):

  1. Install native glab.exe on Windows — winget install glab.glab. Once host glab isn't ENOENT, the WSL fallback path no longer triggers. You don't need to actually glab auth login; the probe resolves on host.
  2. Disable the GitLab task provider in Orca Settings → Integrations/Tasks if you don't use GitLab. No GitLab provider → no glab auth status probes at all.

Doing both, I no longer see any wsl.exe -d Ubuntu_24_04 -- bash -c "'glab' 'auth' 'status'" spawns while Orca is open and idle.

The durable fix upstream is probably: extend the #7967 allowDefaultWslFallback: false treatment from diagnoseAuth to the getGlabKnownHosts probe path as well (or respect a per-context "WSL is not my runtime" setting so cwd-less global CLI probes never fall into the default WSL distro when the worktree is win32).

Zettry avatar Jul 30 '26 10:07 Zettry

Resolved by merged #17350. That PR identifies this issue’s repeated glab auth status WSL probes as the source of the VM wakeups and caches preflight probes per distro with concurrent-call deduplication. It also adds TTL self-healing for transient failures.

nwparker avatar Sep 27 '26 10:09 nwparker