Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printenv in shellIntegration-bash.sh cause hang in terminal git bash #238450

Open
lorenzomathis opened this issue Jan 22, 2025 · 3 comments
Open
Assignees
Labels
important Issue identified as high-priority
Milestone

Comments

@lorenzomathis
Copy link

Type: Performance Issue

When i open one terminal with git bash in windows the windows hang for 20/30 second before open totally. After the openig i see the last output of printenv before the prompt.

The row that cause this are in the file shellIntegration-bash.sh, in the function __vsc_update_env . If i delete delete this function and the two call to __vsc_update_env() i dont have any problem anymore.

__vsc_update_env() {
builtin printf '\e]633;EnvSingleStart;%s;\a' $__vsc_nonce
for var in $(compgen -v); do
if printenv "$var" >/dev/null 2>&1; then
value=$(builtin printf '%s' "${!var}")
builtin printf '\e]633;EnvSingleEntry;%s;%s;%s\a' "$var" "$(__vsc_escape_value "$value")" $__vsc_nonce
fi
done
builtin printf '\e]633;EnvSingleEnd;%s;\a' $__vsc_nonce
}

VS Code version: Code - Insiders 1.97.0-insider (d226a2a, 2025-01-22T05:05:14.565Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz (32 x 2095)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.92GB (22.24GB free)
Process Argv --crash-reporter-id cd6f428f-b0f8-40ce-8258-3cb7753136da
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   133	 17420	code-insiders main
    0	    98	  3756	   gpu-process
    0	    30	  9088	   crashpad-handler
    0	   106	 11568	ptyHost
    0	     7	 13544	     conpty-agent
    0	     6	 24928	     "C:\Program Files\Git\bin\bash.exe" --init-file "c:\SoftwareLight\VS Code Insiders\resources\app/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh"
    0	    12	  3704	       "C:\Program Files\Git\bin\..\usr\bin\bash.exe" --init-file "c:\SoftwareLight\VS Code Insiders\resources\app/out/vs/workbench/contrib/terminal/common/scripts/shellIntegration-bash.sh"
    0	   124	 16500	shared-process
    0	   150	 18544	extensionHost [1]
    0	   100	 11356	     "C:\SoftwareLight\VS Code Insiders\Code - Insiders.exe" "c:\SoftwareLight\VS Code Insiders\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=18544
    0	    46	 19632	   utility-network-service
    0	    99	 20728	fileWatcher [1]
    0	   225	 22436	window [1] (settings.json - gui-nmf (Workspace) - Visual Studio Code - Insiders)
Workspace Info
|  Window (settings.json - gui-nmf (Workspace) - Visual Studio Code - Insiders)
|    Folder (gui-proxy.nmf): 450 files
|      File types: js(129) map(57) css(50) html(50) scss(34) json(17) png(7)
|                  woff(7) woff2(5) svg(5)
|      Conf files: dockerfile(2) package.json(1)
|    Folder (gui-ansible.nmf): 76 files
|      File types: yml(26) j2(13) crt(6) cer(2) key(2) md(2) cfg(1) sh(1)
|      Conf files:
|    Folder (gui.nmf): 556 files
|      File types: scss(177) vue(118) js(82) css(40) json(6) png(5) svg(5)
|                  woff(4) woff2(3) md(2)
|      Conf files: dockerfile(1) package.json(1);
Extensions (9)
Extension Author (truncated) Version
vscode-html-css ecm 2.0.12
beautify Hoo 1.5.0
rest-client hum 0.25.1
kubernetes-yaml-formatter ken 2.4.0
vscode-docker ms- 1.29.4
vscode-language-pack-it MS- 1.97.2025012209
vetur oct 0.37.3
uridecode sry 0.3.6
JavaScriptSnippets xab 1.8.0
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aacf:30263846
vscod805cf:30301675
vsaa593cf:30376535
py29gd2263:31024238
c4g48928:30535728
962ge761:30841072
pythonnoceb:30776497
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
dvdeprecation:31040973
dwnewjupyter:31046869
2f103344:31071589
nativerepl1:31134653
pythonrstrctxt:31093868
nativeloc1:31118317
cf971741:31144450
e80f6927:31120813
iacca1:31150324
notype1:31143044
dwcopilot:31158714
h409b430:31177054
5b1c1929:31184661
6074i472:31201624
dwoutputs:31217127
6e63a538:31218797
9064b325:31222308
copilot_t_ci:31222730

@Tyriar Tyriar added this to the January 2025 milestone Jan 22, 2025
@Tyriar Tyriar added the important Issue identified as high-priority label Jan 22, 2025
@anthonykim1
Copy link
Contributor

anthonykim1 commented Jan 22, 2025

Thanks for filing this. @lorenzomathis

Does the problem happen in regular bash terminal too? or just gitbash?

I assume it doesnt happen for pwsh on the same machine, is that correct?

Edit: In the meantime I have commented out the relevant code that is causing this delay. Next insider release should be better for you, but I'd love to hear back once I merge in proper fix for this.

@lorenzomathis
Copy link
Author

Thanks for response.

I have not tested the normal bash because I only work with git bash even outside of the Visual Studio Code insider program. It is correct that the problem does not occur for pwsh on the same machine.
Thanks for the quick temporary fix.

@anthonykim1
Copy link
Contributor

Hi @lorenzomathis I just wanted to give you an update -

I have made better optimization #238488 but it wouldn't be until mid February before I merge in this code and ask you for another confirmation (your git bash shouldnt get this slow). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important Issue identified as high-priority
Projects
None yet
Development

No branches or pull requests

3 participants