Skip to content

Host becomes unresponsive during synchronous subprocess wait instead of timing out cleanly #305740

@ajbudlong

Description

@ajbudlong

Type: Performance Issue

Description

When an external subprocess stalls, the host can become unresponsive if the subprocess is waited on synchronously from a UI-thread or event-loop-owned execution path. I believe this is a separate resilience issue from the child-process bug itself.

I created a self-contained reproduction showing the host-side failure mode without depending on the original application code. The reproduction demonstrates that a blocking subprocess.wait() on the event-loop thread starves the host loop, while offloading the same wait preserves responsiveness.

This report is about the host freeze behavior, not the original child-process locking bug.

VS Code Version

Observed in a Windows environment. Exact VS Code build should be filled in from the affected machine when filing.

OS Version

Windows

Steps to Reproduce

  1. Run the self-contained reproduction in host_freeze_repro.py.
  2. Observe the Blocking subprocess.wait() on event-loop thread section.
  3. Compare it with the Offloaded subprocess.wait() preserves event loop section.
  4. Optionally run test_host_freeze_repro.py with pytest.

Commands:

python host_freeze_repro.py
python -m pytest test_host_freeze_repro.py -q

Expected Behavior

  • A slow or stalled subprocess should not freeze the host.
  • UI/event-loop work should continue while the child process is pending.
  • Timeout and cancellation should remain serviceable.
  • The host should surface an error state rather than becoming unresponsive.

Actual Behavior

  • If the host performs a synchronous wait on the same thread that services events, event-loop progress stalls.
  • In the repro, heartbeat activity pauses for approximately the same duration as the child-process wait.
  • The offloaded version does not show the same starvation pattern.

Does This Issue Occur When All Extensions Are Disabled?

The original symptom involved extension-driven subprocess execution, so the real-world scenario is extension-related. The attached repro is extension-independent and demonstrates the host-side design risk directly.

Reproduction Files

Why I Think This Belongs In VS Code

Even if an extension or child process misbehaves, the host should avoid blocking the execution path responsible for responsiveness. If VS Code or an extension-host layer exposes or encourages a synchronous subprocess wait pattern in a latency-sensitive path, that is a host resilience problem.

Likely Fix Area

Please inspect the process-launch and process-wait path used by the extension host or related integration layers for any of the following on a responsiveness-critical thread:

  • synchronous wait() or run() calls
  • blocking process output draining
  • sync-over-async bridges around subprocess completion

The likely fix is to move waiting and stream handling off the host thread or use a fully asynchronous subprocess flow.

VS Code version: Code 1.113.0 (cfbea10, 2026-03-24T15:07:18+01:00)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 7 165U (14 x 2688)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x8086, DEVICE=0x7d45 [Intel(R) Graphics], DRIVER_VENDOR=Intel, DRIVER_VERSION=32.0.101.8332 ACTIVE
GPU1: VENDOR= 0x1414, DEVICE=0x008c [Microsoft Basic Render Driver], DRIVER_VERSION=10.0.26100.7309
Machine model name:
Machine model version:
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.45GB (2.71GB free)
Process Argv --crash-reporter-id 5635b230-cd5f-4ce9-8a4c-135551ad6c28
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   220	 21256	code
    0	   328	  3276	   gpu-process
    0	   136	 19096	file-watcher [1]
    0	   159	 21136	pty-host
    0	   107	  4420	     C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Program Files\Microsoft VS Code\cfbea10c5f\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	    87	  9316	     C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command "try { . \"c:\Program Files\Microsoft VS Code\cfbea10c5f\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1\" } catch {}"
    0	    13	 14404	     conpty-agent
    0	    13	 17188	     conpty-agent
    0	   142	 25496	     C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Import-Module 'c:\Users\adbudl\.vscode\extensions\ms-vscode.powershell-2025.4.0\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2025.4.0' -BundledModulesPath 'c:\Users\adbudl\.vscode\extensions\ms-vscode.powershell-2025.4.0\modules' -EnableConsoleRepl -StartupBanner \"PowerShell Extension v2025.4.0
Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell
Type 'help' to get help.
\" -LogLevel 'Warning' -LogPath 'c:\Users\adbudl\AppData\Roaming\Code\logs\20260327T122112\window1\exthost\ms-vscode.powershell' -SessionDetailsPath 'c:\Users\adbudl\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-21256-143946.json' -FeatureFlags @() "
    0	    13	 28708	     conpty-agent
    0	   107	 22452	   utility-network-service
    0	   396	 24824	window [1] (Preview HOST_FREEZE_ISSUE_BODY_COPILOT.md - freeze-issue - Visual Studio Code)
    0	   133	 25168	   window
    0	   164	 25456	shared-process
    0	   610	 31712	extension-host [1]
    0	   115	  7984	     "C:\Program Files\Microsoft VS Code\Code.exe" "c:\Program Files\Microsoft VS Code\cfbea10c5f\resources\app\extensions\markdown-language-features\dist\serverWorkerMain" --node-ipc --clientProcessId=31712
    0	   117	 17952	     "C:\Program Files\Microsoft VS Code\Code.exe" "c:\Program Files\Microsoft VS Code\cfbea10c5f\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=31712
    0	    15	 27956	     c:\Users\adbudl\.vscode\extensions\ms-python.vscode-python-envs-1.24.0-win32-x64\python-env-tools\bin\pet.exe server
    0	    12	 24144	       C:\WINDOWS\system32\conhost.exe 0x4
    0	   564	 28948	     electron-nodejs (bundle.js)
    0	    99	 32164	   crashpad-handler
Workspace Info
|  Window (Preview HOST_FREEZE_ISSUE_BODY_COPILOT.md - freeze-issue - Visual Studio Code)
|    Folder (freeze-issue): 13 files
|      File types: md(6) py(3) ps1(2) json(1)
|      Conf files:;
Extensions (14)
Extension Author (truncated) Version
copilot-chat Git 0.41.2
vscode-github-actions git 0.31.2
rainbow-csv mec 3.24.1
debugpy ms- 2025.18.0
python ms- 2026.4.0
vscode-pylance ms- 2026.1.1
vscode-python-envs ms- 1.24.0
cmake-tools ms- 1.22.28
cpp-devtools ms- 0.4.6
cpptools ms- 1.31.3
cpptools-extension-pack ms- 1.5.1
makefile-tools ms- 0.12.17
powershell ms- 2025.4.0
vscode-yaml red 1.21.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
6abeh943:31336334
envsactivate1:31464700
cloudbuttont:31379625
aihoversummaries_f:31469309
3efgi100_wstrepl:31403338
use-responses-api:31390855
defaultusage:31403421
je187915:31401257
ec5jj548:31422691
cp_cls_t_966_ss:31454198
a9239246:31483273
4je02754:31466945
8hhj4413:31478653
ge8j1254_inline_auto_hint_haiku:31431912
38bie571_auto:31478677
cp_cls_t_1081:31454832
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_control1:31471004
g_63ac8346:31467999
idci7584:31464702
showingstats:31481873
534a6447:31478749
hg17d649:31458077
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
67jbj424:31484169
bg_compact_t:31481650
t-some:31484756
cpptoolson-v2:31475363
db0gd219:31481871
ec1eg703:31484515
client_tst_c:31484206
po_split_t:31483953
ddid_c:31478207
nes-perm-reb-0:31481661

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions