vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Terminal full black

Open vikpascual opened this issue 1 year ago • 6 comments

Type: Bug

I dont know how to reproduce this bug. I just restart VSCode after last update. This happens with powershell, git bash and python debug terminal. I disabled GPU acceleration but nothing changed. image

VS Code version: Code 1.80.0 (660393deaaa6d1996740ff4880f1bad43768c814, 2023-07-04T15:06:02.407Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz (12 x 2688)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.75GB (8.24GB free)
Process Argv --crash-reporter-id e61d592b-9712-4e12-b33c-5612294180e7
Screen Reader no
VM 0%
Extensions (16)
Extension Author (truncated) Version
node-js-snippet abd 1.1.3
javascript-ejs-support Dig 1.3.3
jquerysnippets don 0.0.1
code-runner for 0.12.0
prettify-json moh 0.0.3
isort ms- 2022.8.0
python ms- 2023.10.1
vscode-pylance ms- 2023.7.10
jupyter ms- 2023.6.1001861915
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.17
vscode-jupyter-cell-tags ms- 0.1.8
vscode-jupyter-slideshow ms- 0.1.5
cpptools ms- 1.16.3
bootstrap4-vscode the 6.1.0
JavaScriptSnippets xab 1.8.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30776702
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
2i9eh265:30646982
showlangstatbar:30737416
vsctsb:30748421
pythonms35:30701012
03d35959:30757346
pythonfmttext:30731395
pythoncmv:30756943
fixshowwlkth:30771522
showindicator:30766890
pythongtdpath:30769146
bgfeh915:30780428
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnocebcf:30776496
cmakesidepanelv2:30779593

vikpascual avatar Jul 06 '23 21:07 vikpascual

I have met this bug as well after upgrading to 1.80.0. The way I reproduce this is to

  1. start a docker container of ubuntu
  2. connect to the container with dev-container
  3. start a new C++ project with CMake extension
  4. just compile and run.
  5. closing all the terminal
  6. start a new terminal

From now on, the terminal is full black. But I could still start the terminal with '+' icon. It can be fixed by restart vscode. I hope this imformation could be helpful.

Kidsunbo avatar Jul 07 '23 09:07 Kidsunbo

The first thing I did was to close all terminals and create new ones with the '+' symbol. The new terminals were experiencing the same issue. Then, I restarted VSCode and created new terminals again, but they still had the same problem.

vikpascual avatar Jul 07 '23 11:07 vikpascual

After updated latest, I also occur this issue sometime.

Version: 1.80.0
Commit: 660393deaaa6d1996740ff4880f1bad43768c814
Date: 2023-07-04T13:40:17.963Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.5.0

tjx666 avatar Jul 07 '23 19:07 tjx666

I'm also having this issue, can it be fixed recently @meganrogge

wulling1024 avatar Jul 08 '23 00:07 wulling1024

After uninstalling and installing VSCode the problem persists. Terminal works but I can see nothing. image

vikpascual avatar Jul 08 '23 07:07 vikpascual

Plz also check if the issue goes away after disabling terminal image support:

"terminal.integrated.enableImages": false

@Tyriar I remember a similar issue happened when tabby integrated image support for the first time, but I had no chance to verify, as the reporter never answered in the issue thread. Could that be some electron/chrome gpu driver issue not being able to do transparent composition, and thus falling back to just a black canvas? Note that I never experienced that myself, so I am not even sure, if it is related to the image addon at all.

jerch avatar Jul 09 '23 19:07 jerch

@jerch That fixed the problem for me.

JoonChicken avatar Jul 09 '23 20:07 JoonChicken

That fixed the problem for me too. Can I close this thread?

vikpascual avatar Jul 10 '23 07:07 vikpascual

Thx for the confirmations. I cannot really help to further debug this with electron/vscode, as I dont know how things like --disable-gpu or chrome://gpu play into this for electron. I also cannot repro it with any device I have access to.

It pretty much smells like a driver issue with degraded transparent canvas composition, as the image canvas is meant to be a transparent layer above the terminal text layer drawing image tiles on top. This normally works for all text layer renderer types (DOM, canvas or webgl2).

Can I close this thread?

Imho it is better to keep it open for now, as the circumstances, when the canvas gets wrongly painted black instead of transparent, might need further investigation.

jerch avatar Jul 10 '23 07:07 jerch

Anyway I don't know if it has something to do with it, but, I always have GPU acceleration disabled because this other problem happens. I don't know if it will help you. Can't read nothing in VSCode if GPU acceleration is on. image

vikpascual avatar Jul 10 '23 07:07 vikpascual

Related question and answer on Stack Overflow.

And a duplicate question. And another duplicate. And another one. And another one 🙃.

Help with closing the duplicates would be appreciated if you have the privilege level on Stack Overflow to do so (flag or close-vote) so that the answers can all be found in one place instead of scattered about.

starball5 avatar Jul 10 '23 15:07 starball5

@starball5 Regarding your SO answer - imho this is not a bug in vscode, but more a gpu / driver / chromium bug for some rare constellations, for which vscode has no workaround yet. I think the majority of users dont face it at all.

Ofc the question remains - how to fix this for the last <<10% of users? Maybe @Tyriar has more insights, when this actually happens and how to avoid it. To me it seems very likely, that if the webgl or the canvas renderer dont work properly on a machine, the image overlay never gonna work sufficiently, as it def. needs the transparent overlaying (there is no other way around with the DOM renderer underneath, on the other hand for webgl/canvas the output could theoretically be merged into just one canvas).

Apparently, the problem can be fixed for one time by force-quitting and restarting VS Code, but the problem comes back every time the terminal is killed.

This seems to be a second issue, or triggered by other means. @Tyriar is there a way to determine a post resume state from electron? Maybe an explicit canvas refresh after resume already fixes this? Is there some other state holding going on between terminal kills?

jerch avatar Jul 11 '23 09:07 jerch

Bit late to join here but I'm thinking we should only allow images when the canvas or webgl renderers are being used, in other words, depending on terminal.integrated.gpuAcceleration.

@jerch do we need { alpha: true } on any of these getContext calls?

https://github.com/search?q=repo%3Ajerch%2Fxterm-addon-image%20getcontext&type=code

The regular renderers are all opaque in VS Code so this canvas is a little special compared to them.

Tyriar avatar Jul 11 '23 14:07 Tyriar

Well this one here is def. needed, otherwise the transparent overlaying does not work: https://github.com/jerch/xterm-addon-image/blob/5f5bae8c5fc4fe5269e3025a4f96ace38fc300e1/src/ImageRenderer.ts#L311

All others are set to alpha: false, which should be the default setting anyway.

I am not sure, if the desynchronized: true creates further driver issues here, if so we can remove it (runs abit slower in chromium without, but not much).

jerch avatar Jul 11 '23 14:07 jerch

I doubt desynchronized would cause problems, let's go with checking if the DOM renderer is being used and disable it in that case

Tyriar avatar Jul 11 '23 14:07 Tyriar

To clarify, this will be a VS Code-side change, so I'll unload the addon when DOM is used

Tyriar avatar Jul 11 '23 14:07 Tyriar

To clarify, this will be a VS Code-side change, so I'll unload the addon when DOM is used

Yepp, sounds good.

jerch avatar Jul 11 '23 14:07 jerch

~I also want to point out, that the issue #184894 is still open. The patch release 0.4.2 hopefully resolves that one.~ Woops, you were a little bit faster :smile_cat:

jerch avatar Jul 11 '23 15:07 jerch

@Tyriar Is this issue worth to be further investigated or even reported to chromium devs at some point? Not being able to use transparent canvas layering on some machines these days looks to me like a rather bold issue for the browser engine with the biggest marketshare.

Ofc this only makes sense if you can track down the issue further, e.g. which platform + gpu settings are affected. I would suspect that their is a common pattern to be found in chrome://gpu for those machines, sadly chrome's gpu/canvas stack is quite convoluted with all sorts of software shims to fix this or that, so it might be hard to spot this pattern. Well idk if it is worth the extra rounds, maybe only if a bigger percentage of ppl are affected by it.

jerch avatar Jul 13 '23 09:07 jerch

@jerch if we could get a minimal repro we could, I wouldn't want to potentially waste their time without one though. We've always had a class of users where GPU acceleration just doesn't work, some need to move on to terminal's dom renderer, and some need to launch Electron with --disable-gpu.

Tyriar avatar Jul 13 '23 14:07 Tyriar

@Tyriar

I can still occur this issue in latest recovery1:

Version: 1.80.1
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:20:58.115Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.5.0

https://github.com/microsoft/vscode/assets/41773861/3eac6086-6b69-4c3f-91f8-ad264968e114

tjx666 avatar Jul 14 '23 20:07 tjx666

@Tyriar

I can still occur this issue in latest recovery1:

Version: 1.80.1
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:20:58.115Z
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 22.5.0

2023-07-15.04.04.27.mov

this might be another bug. https://github.com/microsoft/vscode/issues/187772

Kidsunbo avatar Jul 15 '23 04:07 Kidsunbo

I figured my dark terminal was caused by my old Nvidia driver. Yesterday, they released a new update and the terminal was perfectly okay after.

Thanks y'all

42n8dzydoo avatar Jul 21 '23 15:07 42n8dzydoo