Skip to content

workspaceHasPython watcher runs one full-workspace findFiles per created/deleted marker file (no debounce) — a git checkout spawns hundreds of rg.exe and freezes the machine #1989

Open

Description

@guojia-ekyc

Problem

Since 1.42.0 (PR #1663, src/features/views/workspacePythonContext.ts) the extension watches **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig.json} across the whole workspace and calls findFiles(MARKER_GLOB, EXCLUDE, 1) on every create/delete event. VS Code implements each findFiles call by spawning a fresh rg.exe --files over the workspace from the extension host. A git checkout / git worktree add / git worktree remove that touches ~1–2k Python files therefore spawns ~1–2k ripgrep processes (plus one conhost.exe each) within seconds. On my machine this froze Windows three times in one day and ended in a DPC_WATCHDOG_VIOLATION (0x133) bugcheck each time.

The "ticket" counter in registerWorkspacePythonContext only discards stale results; it does not prevent the spawns.

Environment data

  • Python Environments extension version: 1.42.0 (code unchanged on main @ 1.43.0)
  • Python extension (ms-python.python) version: 2026.10.0 (python.useEnvironmentsExtension at default false)
  • VS Code version (Help → About): 1.145.0 (commit a717861c07586a53d83b80d742cd3f59b20a6273), x64
  • OS and version: Windows 11 Home 25H2, build 26200.9711
  • Python version: not relevant — the scan runs before any interpreter is used
  • Environment manager in use: venv
  • Shell: pwsh / Git Bash
  • Remote / container scenario: none
  • Workspace type: single folder, mono-repo (Vue frontend + FastAPI backend, ~5k tracked files; several git worktrees live under <repo>/.worktrees/, ~125k files on disk in total)
  • Is this a regression? Yes. 1.40.0 does not contain workspacePythonContext.ts; the behaviour arrived with 1.42.0.

Repro Steps

  1. Open a repo that contains ≥1000 *.py files in VS Code with the extension installed (any Python project of that size; a Django/FastAPI backend is enough).
  2. Make the files appear or disappear in bulk from outside the editor, e.g. in a terminal:
    git worktree add --detach --no-checkout .wt/probe HEAD && git -C .wt/probe checkout HEAD -- backend/
    (or simply git checkout <branch-that-differs-by-1000-py-files>).
  3. Watch the process list (Get-Process rg | Measure-Object).

Expected behavior

At most one (debounced) findFiles scan after the burst settles; a handful of rg.exe processes at most.

Actual behavior

One rg.exe + one conhost.exe per file event. Measured on the repo above (callcenter-backend/, 1939 files of which 1264 match MARKER_GLOB):

16:11:43  baseline procs=378
16:11:45  procs=464 (+86)   new: rg=49  conhost=42          <- git still running
16:11:49  git exited after 5.8 s
16:11:50  procs=585 (+207)  new: conhost=107 rg=101
16:11:58  procs=679 (+301)  new: conhost=153 rg=152
16:12:04  procs=765 (+387)  new: conhost=195 rg=194         <- still climbing ~20/s after git is gone
16:15:35  VS Code main.log: "CodeWindow: detected unresponsive" (repeats every 16 s)
16:17:10  Windows bugcheck 0x133 DPC_WATCHDOG_VIOLATION

Parent of every rg.exe is the extension host (Code.exe --type=utility --utility-sub-type=node.mojom.NodeService; confirmed via --clientProcessId of the ESLint server it also hosts). Command line of each one:

"...\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig.json} -g !**/.git -g !**/.svn -g !**/.hg -g !**/.jj ...

A control run that checked out 511 non-Python files (frontend/src) spawned zero rg.exe, so the trigger is specifically the MARKER_GLOB watcher. Two earlier freezes the same day (a 5536-file git checkout with 1945 marker files, and a 5125-file git worktree add with 1329 marker files) show the same signature.

Logs

The "Python Environments" output channel is empty for this path — refresh() only logs on failure. Process-level timeline and the captured rg.exe command lines are inlined below.

probe timeline (1 s sampling around the checkout, Windows username redacted)
16:11:43.261 stage=s2 paths=callcenter-backend kill: procs+250 or avail<6000MB
16:11:43.297 baseline procs=378 avail=13630MB code_ws=2917MB
16:11:43.313 checkout started pid=78852
16:11:44.361 t+  1s procs=381 (+3) new=2 avail=13451MB code_ws=2991MB git_alive=True top_new=git=1;conhost=1
16:11:45.615 t+  2s procs=464 (+86) new=94 avail=13545MB code_ws=2985MB git_alive=False top_new=rg=49;conhost=42;bash=2;node=1
16:11:48.436   CAPTURED 90 new processes via CIM in 2.7s -> s2-20261105-161142-spawned.csv
16:11:48.540      49 x rg.exe, Code
16:11:48.600      41 x conhost.exe, rg
16:11:48.741     sample: rg.exe ppid=33720 (Code) 16MB  "C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\w
16:11:48.820     sample: rg.exe ppid=33720 (Code) 16MB  "C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\w
16:11:48.887     sample: rg.exe ppid=33720 (Code) 15MB  "C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\w
16:11:48.960     sample: rg.exe ppid=33720 (Code) 15MB  "C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\w
16:11:49.039     sample: rg.exe ppid=33720 (Code) 14MB  "C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\w
16:11:49.132   git exited code= after 5.8s
16:11:50.280 t+  7s procs=585 (+207) new=217 avail=12941MB code_ws=3021MB git_alive=False top_new=conhost=107;rg=101;bash=6;docker=2;node=1
16:11:51.503 t+  8s procs=608 (+230) new=240 avail=12874MB code_ws=3026MB git_alive=False top_new=conhost=116;rg=112;bash=9;node=2;lark-cli=1
16:11:52.703 t+  9s procs=628 (+250) new=260 avail=12891MB code_ws=3034MB git_alive=False top_new=conhost=126;rg=122;bash=10;lark-cli=1;node=1
16:11:54.088 t+ 11s procs=649 (+271) new=281 avail=12868MB code_ws=2955MB git_alive=False top_new=conhost=135;rg=131;bash=11;taskkill=1;node=1
16:11:55.629 t+ 12s procs=665 (+287) new=297 avail=12782MB code_ws=2959MB git_alive=False top_new=conhost=143;rg=137;bash=11;taskkill=2;docker=1
16:11:56.917 t+ 14s procs=666 (+288) new=298 avail=12782MB code_ws=2958MB git_alive=False top_new=conhost=147;rg=145;bash=5;taskkill=1
16:11:58.060 t+ 15s procs=679 (+301) new=311 avail=12697MB code_ws=2964MB git_alive=False top_new=conhost=153;rg=152;bash=5;docker=1
16:11:59.262 t+ 16s procs=696 (+318) new=328 avail=12601MB code_ws=2957MB git_alive=False top_new=conhost=162;rg=159;bash=5;docker=2
16:12:00.500 t+ 17s procs=712 (+334) new=344 avail=12487MB code_ws=2960MB git_alive=False top_new=conhost=170;rg=167;bash=5;docker=2
16:12:01.856 t+ 19s procs=728 (+350) new=360 avail=12390MB code_ws=2965MB git_alive=False top_new=conhost=177;rg=176;bash=5;docker=2
16:12:03.068 t+ 20s procs=746 (+368) new=378 avail=12316MB code_ws=2972MB git_alive=False top_new=conhost=187;rg=185;bash=5;docker=1
16:12:04.308 t+ 21s procs=765 (+387) new=397 avail=12209MB code_ws=2974MB git_alive=False top_new=conhost=195;rg=194;bash=5;svchost=2;docker=1
16:12:19.457 SUMMARY stage=s2 files_in_worktree=1939 killed=False peak_new=397 (conhost=195;rg=194;bash=5;svchost=2;docker=1) code_ws 2917MB -> peak 3034MB -> now 2967MB avail 13630MB -> 12203MB procs 378 -> 768
16:12:19.907 worktree kept for the next stage
16:12:20.062 log: C:\code\botim-insight-desk\.local\memwatch\probe\s2-20261105-161142.txt
90 processes captured via CIM 5 s into the burst: pid, ppid, name, parent, private MB, start time, command line
"pid","name","ppid","parent","priv_mb","started","cmdline"
"42692","rg.exe","33720","Code","16","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"80012","conhost.exe","42692","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"36824","rg.exe","33720","Code","15","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"45580","rg.exe","33720","Code","14","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"39548","conhost.exe","36824","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"27792","rg.exe","33720","Code","14","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"4768","conhost.exe","45580","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"68588","rg.exe","33720","Code","16","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"42984","conhost.exe","27792","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"56764","rg.exe","33720","Code","13","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"34808","conhost.exe","68588","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"28168","rg.exe","33720","Code","14","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"61548","conhost.exe","56764","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"77860","rg.exe","33720","Code","14","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"35572","rg.exe","33720","Code","15","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"74164","conhost.exe","28168","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"86208","rg.exe","33720","Code","12","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"45316","rg.exe","33720","Code","6","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"79480","rg.exe","33720","Code","13","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"75120","rg.exe","33720","Code","12","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"59296","conhost.exe","77860","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"31476","conhost.exe","86208","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"78300","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"36148","conhost.exe","35572","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"9128","conhost.exe","75120","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"39720","conhost.exe","79480","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"48736","rg.exe","33720","Code","7","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"63604","conhost.exe","78300","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"37852","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"41708","rg.exe","33720","Code","14","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"38224","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"51612","conhost.exe","41708","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"65780","rg.exe","33720","Code","7","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"66220","conhost.exe","45316","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"3032","rg.exe","33720","Code","6","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"13308","conhost.exe","38224","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"42868","conhost.exe","65780","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"84404","conhost.exe","37852","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"68280","conhost.exe","3032","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"28956","conhost.exe","48736","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"876","rg.exe","33720","Code","7","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"29492","rg.exe","33720","Code","4","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"54380","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"30356","conhost.exe","876","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"19528","rg.exe","33720","Code","7","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"57112","rg.exe","33720","Code","5","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"36984","conhost.exe","54380","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"74064","rg.exe","33720","Code","5","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"34312","rg.exe","33720","Code","7","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"35796","conhost.exe","19528","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"66156","rg.exe","33720","Code","6","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"44132","rg.exe","33720","Code","6","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"6148","conhost.exe","34312","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"72140","conhost.exe","66156","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"49032","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"38596","rg.exe","33720","Code","3","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"46668","rg.exe","33720","Code","8","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"72056","conhost.exe","49032","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"72652","conhost.exe","57112","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"53548","rg.exe","33720","Code","4","2026/11/5 16:11:44","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"62984","conhost.exe","46668","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"85824","conhost.exe","29492","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"84364","conhost.exe","74064","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"81800","conhost.exe","53548","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"54792","conhost.exe","44132","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"72084","conhost.exe","38596","rg","1","2026/11/5 16:11:44","\??\C:\Windows\system32\conhost.exe 0x4"
"30640","rg.exe","33720","Code","7","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"82740","rg.exe","33720","Code","4","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"72816","conhost.exe","30640","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"38404","rg.exe","33720","Code","4","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"83656","rg.exe","33720","Code","7","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"9076","rg.exe","33720","Code","4","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"86292","conhost.exe","83656","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"57076","rg.exe","33720","Code","4","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"80328","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"19724","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"75428","rg.exe","33720","Code","5","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"60232","conhost.exe","80328","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"41144","conhost.exe","75428","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"54912","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"47160","rg.exe","33720","Code","4","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"62376","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"29664","conhost.exe","47160","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"39652","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"36588","conhost.exe","82740","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"67156","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"31820","conhost.exe","38404","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"39164","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."
"37692","conhost.exe","9076","rg","1","2026/11/5 16:11:45","\??\C:\Windows\system32\conhost.exe 0x4"
"81592","rg.exe","33720","Code","3","2026/11/5 16:11:45","""C:\Users\<user>\AppData\Local\Programs\Microsoft VS Code\a717861c07\resources\app\node_modules.asar.unpacked\@vscode\ripgrep-universal\bin\win32-x64\rg.exe"" --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,requirements.txt,Pipfile,pyvenv.cfg,mspythonconfig."

Suggested fix

In registerWorkspacePythonContext:

  1. A create event can only make the answer true. On onDidCreate, if the context is already true, do nothing; if it is false, set it to true directly — no findFiles needed at all.
  2. Only delete events can make it false, and only when it is currently true. Debounce those (the repo already has createSimpleDebounce, used by the venv watchers with 500 ms) and run a single scan after the burst.
  3. Pass a CancellationToken to findFiles and cancel the in-flight scan when a new one is queued, so a slow scan cannot pile up behind the next.
  4. Optionally skip scanning when workspace.workspaceFolders is empty / on onDidChangeWorkspaceFolders only.

Additional context

  • Root cause pointer: src/features/views/workspacePythonContext.ts lines 60–70 (onMarkerChanged → void refresh() per event).
  • files.exclude / search.exclude do not reduce the cost because an explicit exclude is passed to findFiles, which disables the default excludes; files.watcherExclude only helps for paths you can afford to exclude.
  • Workaround that worked for me: uninstall the extension (ms-python.python does not depend on it when python.useEnvironmentsExtension is false).

Activity

  1. ttachon commented on Nov 5, 2026

    @ttachon

    Same issue, independently diagnosed on a second machine: 5 × DPC_WATCHDOG_VIOLATION (0x133) in one day.

    Environment: Python Environments 1.42.0 · Python 2026.10.0 · VS Code 1.145.0 (a717861c07) · Windows 11 Pro 25H2 26200.9711 · Memory Integrity (HVCI) on · i7-11850H, 16 threads.

    Trigger: several coding-agent sessions working in the workspace (they create/delete files and git worktrees inside it), so it's the same bulk create/delete pattern as above. The first rg.exe appeared one second after the extension activated, and 67 were alive within a minute.

    Measured: in ~5 minutes the extension host launched 939 identical rg.exe --files … -g **/{*.py,*.pyi,…,mspythonconfig.json} … --no-ignore --follow, with up to 124 alive at once, 16 threads each (no --threads by default). The PC froze until they were killed.

    Kernel side (4 minidumps): the stuck CPU is always in KiRetireDpcList → KiTimer2Expiration → KiProcessThreadWaitList → KiDeferredReadySingleThread → … → HvlSendSyntheticClusterIpi (Arg1 = 1), with VS Code's bundled rg.exe as the current process. That ripgrep (15.0.0) imports CreateWaitableTimerExW, and its idle walker threads sleep in 1 ms high-resolution waits. So 100+ concurrent scans × 16 threads means thousands of high-res timers, and their expiry storm trips the DPC watchdog. This is the same signature as anthropics/claude-code#76654 and microsoft/vscode#313167.

    Nuance on the workaround notes: on 1.145.0 the spawned rg does pick up files.exclude (adding "**/<big-ignored-dir>": true showed up as -g !**/<big-ignored-dir>). Likewise, "search.ripgrep.maxThreads": 1 added --threads 1 and "search.followSymlinks": false removed --follow. That makes each scan much cheaper, but it doesn't stop the per-event spawning. Uninstalling the extension was the only full fix; Python and Pylance keep working without it.

    +1 to the proposed fix: a create event sets true without scanning, deletes are debounced, and the in-flight scan is cancelled.

  2. Starland9 commented on Nov 5, 2026

    @Starland9

    Confirming on Linux (the report above is Windows-only), with a root-cause trace and a trigger other than git checkout: AI coding agents creating git worktrees inside the workspace.

    Environment

    • Python Environments 1.42.0 · Python 2026.10.0 · VS Code 1.145.0 (a717861c07) · Linux (Mint/Cinnamon, kernel 7.0.0), 16 cores, 31 GB RAM
    • Multi-root workspace, ~18k .py files. Claude Code agents create worktrees under <repo>/.claude/worktrees/ (9 at the time, ~1,800 .py each, 1.6 GB in total).

    Reproduction (VS Code started with --log trace, inside a cgroup capped at 8 GB RAM / 4000 tasks, with a watchdog stopping it above 150 live rg processes)

    • The storm built up within ~8 minutes of opening the window. A new worktree appeared a minute before the watchdog fired.
    • Over ~4 minutes the extension host log contains 742 extHostWorkspace#findFiles…: fileSearch, extension: ms-python.vscode-python-envs entries (vs. 3 for vscode.npm and 2 for GitHub.copilot-chat) and 600 ExtHostSearch … rg --files -g **/{*.py,*.pyi,*.ipynb,pyproject.toml,…} spawns.
    • When stopped: 289 live rg processes, load average 11.7 on 16 cores. Every rg is a child of the extension host.

    Impact on Linux

    • The kernel OOM killer repeatedly killed VS Code renderers and other apps (6 global OOM kills in about 40 minutes). On the previous boot the machine froze hard with no clean shutdown (journal ends at "Under memory pressure"), 3 minutes after several worktrees had been created. atop recorded ~36,000 short-lived rg children of a single extension host in 30 minutes.

    Reading the code (1.42.0)

    • findFiles(MARKER_GLOB, EXCLUDE, 1): maxResults = 1 does not help, each call still spawns a full rg --files. The ticket counter only discards stale results, as noted in the description.
    • onDidOpenTextDocument (for Python documents) and onDidChangeWorkspaceFolders call the same function without throttling.
    • The path filter only skips node_modules|.git|site-packages, so .venv, .worktrees, .claude/worktrees, etc. still trigger a scan per event.

    Suggested fix

    1. Coalesce events with a trailing debounce (a few hundred ms) and allow at most one findFiles in flight, passing a CancellationToken so a newer scan cancels the older one.
    2. Skip onDidCreate when the context key is already true (a creation cannot change it); only re-check after a delete.
    3. Ignore well-known non-project directories in the watcher callback.

    Workaround: roll back to 1.40.0 (no workspacePythonContext.ts) or disable the extension.

  3. ryijin commented on Nov 5, 2026

    @ryijin

    Same bug in a Remote-SSH setup. There it was not a short spike: the host stayed overloaded for about four hours, and new SSH connections mostly failed.

    Environment

    • Python Environments 1.42.0, Python 2026.10.0, VS Code Server 1.140.0 (07f806f)
    • Remote host: Linux container, 12 threads, 56 GiB memory limit, 12 GiB swap
    • Workspace: one folder with about 100 subfolders, most of them git worktrees

    Likely trigger
    A background script creates and removes a full git worktree inside the workspace folder, once per pull request. Both stalls began right after that script started. We have not reduced this to a minimal repro.

    Measured while it was stuck

    • About 1,700 live rg --files --hidden --case-sensitive --no-require-git -g **/{*.py,*.pyi,...} ... --no-ignore --follow processes, all but one children of a single extension host, using about 26 GiB (summed RSS)
    • 563 zombie children of the same extension host
    • Swap full, memory pressure (PSI some) at 98 %, load average around 700
    • A new extension host, started after the client reconnected, went from 601 to 955 rg processes in 41 seconds

    What may add to the reports above

    • It did not clear on its own within hours. The processes went away around the time the old extension host exited, after the 5-minute reconnection grace period expired.
    • Because connecting to the host was what failed, the window was no way to intervene.
    • Other work on the host starved too. Our script hung until its 6-hour service timeout.

    The fix suggested above would cover this case as well.

  4. JeanFrancoisGagne commented on Nov 8, 2026

    @JeanFrancoisGagne

    Same bug on a third Windows machine, with two things this thread doesn't have yet: the failure mode is the commit limit, which takes the whole editor down, and a workspace that is the user's home folder makes activity outside any repo set it off.

    Environment: Python Environments 1.42.0 · VS Code (bundled @vscode/ripgrep-universal) · Windows 11 Pro 10.0.26200 · 64 GB RAM. One window had the home folder (C:\Users\<user>) open as its workspace; other windows had project folders.

    Trigger: with the home folder as the workspace, the marker watcher covers AppData too, so every .py that pytest temp folders, uv's cache or coding agents create or delete under the profile starts another rg --files --hidden … --no-ignore --follow over the whole profile, junctions included. No git operation was involved.

    Measured (a 10 s process sampler):

    Time rg.exe under one extension host Free physical memory
    16:03:39 0 33.5 GB
    16:04:58 119 28.6 GB
    16:07:52 121 14.3 GB
    16:09:44 158 1.5 GB

    Ending 258 of them freed 33 GB at once, about 130 MB each. New ones then started at about four a second until the window closed. No new scan started in the 60 s after it closed.

    Failure mode: earlier the same day the machine reached its commit limit twice. VS Code's main.log shows the ptyHost, every utility worker, the agent host and three extension hosts terminating within 30 s (exit 4294930433), and in the second wave a utility process exiting 3221225773 (0xC000012D, STATUS_COMMITMENT_LIMIT), then renderer crashes. Every terminal and extension-host child died with them, including all coding-agent sessions in every window, not only the window that ran the scans.

    Workaround in use: no window with the home folder as its workspace. We also set "search.followSymlinks": false and a files.watcherExclude over **/AppData/** and the cache folders, but have not yet verified whether either reaches this watcher or its findFiles call.

  5. Om-singhaI commented on Nov 8, 2026

    @Om-singhaI

    Eduardo Villalpando Mello (@edvilme) in case it saves you time, #1999 has a fix with tests. A created marker file or an opened Python document sets the context without a search, deletes and folder changes share one debounced rescan, and only one cancellable search runs at a time. In a unit harness, a branch switch with 1000 creates and 1000 deletes now starts one search instead of 2000.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions