kn browser leaks conhost.exe/OpenConsole.exe indefinitely via unthrottled docker stats / dotnet --version polling (Windows)
Description
kn browser leaks a conhost.exe/OpenConsole.exe process roughly every 0.5s while it stays running, with no upper bound. Left running for a few minutes, this accumulates hundreds of orphaned processes and measurably degrades the host system (high process count, elevated CPU/handle usage).
Environment
- OS: Windows 11
- Knowns: v0.29.0 (npm install,
npm i -g knowns) - Repo: a project containing both a
docker-compose.ymland a .NET project (i.e. Knowns detects both a Docker and a .NET environment during project scan)
Repro steps
- In a repo with both Docker Compose and a .NET project present, run:
kn browser - Leave it running (do not touch the terminal).
- Watch process count for
conhost.exe+OpenConsole.exeover time.
Observed
Process count for conhost.exe+OpenConsole.exe grows continuously and linearly for as long as kn browser stays alive. Sample measurement, checked every 15s with nothing else running:
T+0s : 58
T+15s : 85 (+27)
T+30s : 119 (+34)
T+45s : 143 (+24)
T+60s : 171 (+28)
T+75s : 199 (+28)
T+90s : 233 (+34)
~2 new console-host processes/sec, unbounded, for the entire observation window. knowns.exe process count itself stayed flat (2 processes) the whole time — it isn't spawning more copies of itself, something inside it is looping.
Root cause (identified via live process-tree inspection)
Caught the following commands being invoked repeatedly by the running knowns.exe, each one still holding a fresh (not-yet-orphaned) parent PID at capture time:
docker.exe stats --all --no-trunc --no-stream --format "{{ json .}}"
dotnet.exe --version
This looks like an environment/health-check poller (presumably feeding a "Docker: running" / ".NET: vX" status widget on the dashboard) that:
- Runs on a very tight interval (effectively unthrottled, ~2/sec aggregate)
- Spawns a brand new console host for every invocation instead of reusing one / redirecting without allocating a console (e.g. no
CREATE_NO_WINDOW/ no console-host reuse) - Never reaps the console host after the child command exits — it becomes a permanent orphan (reparented by Windows to
svchost.exe -k DcomLaunch)
Killing the knowns.exe process immediately stops all further growth (confirmed multiple times) — the count only ever climbs while it's alive, so the loop lives entirely inside the running process, not in some detached side process.
Suggested fix
- Throttle the environment-status poll interval (a few seconds is plenty for a "is Docker/is dotnet available" indicator — no reason to poll every ~0.5s)
- Reuse a single console host / spawn child processes with
CREATE_NO_WINDOWso no per-invocation console is allocated on Windows - Make sure the poller actually terminates/reaps each child + its console host before the next tick
Impact
On a repo with both Docker and .NET detected, simply leaving kn browser open (e.g. in a background terminal while working) silently exhausts system process/handle resources over time — went from a normal baseline (~550 total processes) to 700+ within 90 seconds in testing, with no indication in the CLI output that anything was wrong.
Thanks for the detailed report and process-tree evidence — that made this much easier to pin down.
I opened a PR here: https://github.com/knowns-dev/knowns/pull/139
The direct fix is commit 2ecd073 (fix(windows): throttle runtime probes):
- Caches LSP/runtime inventory probes so browser/status polling no longer reruns expensive probes every tick.
- Routes spawned probe commands through a shared process helper.
- On Windows, starts child probe processes without allocating a console window, so probes like
dotnet --versionshould no longer create recurringconhost.exe/OpenConsole.exeinstances. - Adds tests for runtime probe caching and Windows no-window process attributes.
Two follow-up commits are also included:
1dd66dbimproves MCP task/time mutation responsiveness by deferring derived indexing to best-effort background work.d7beb0arefreshes README badges/integration guidance and adds uninstall documentation.
Expected result: leaving kn browser idle in a repo with Docker Compose and .NET present should no longer grow conhost.exe / OpenConsole.exe counts linearly. I’ll keep this open until Windows retest confirms it.