microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.66k stars 29.06k forks source link

VS Code blocks Windows from shutting down when there is an update or confirm dialog #150013

Open strich opened 2 years ago

strich commented 2 years ago

Issue Type: Bug

I have been using VS Code for a long time now and love it in most respects. However one of the most frustrating "bugs" is has is its post-exit update process and confirm dialogs - It blocks Windows from shutting down!

Repro: Open an out of date VS Code and ensure an update is ready to install after you close it. Tell Windows to shut down WITHOUT closing VS Code. Windows will sit there and eventually time out the shutdown request leaving you PC on unattended. The same thing will occur if there is a confirm dialog that blocks VS Code from shutting down.

What I expect: VS Code should respect the users' decision to shut down and force quit itself.

VS Code version: Code 1.67.2 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:15:52.058Z) OS version: Windows_NT x64 10.0.22000 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i9-12900K (24 x 3187)| |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
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|63.79GB (34.48GB free)| |Process Argv|--crash-reporter-id 663667d1-fedf-464d-99ad-7c648ef14bbc| |Screen Reader|no| |VM|0%|
Extensions: none
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805:30301674 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 pythonvsnew555:30457759 vscscmwlcmt:30465135 cppdebug:30492333 vsclangdf:30486550 90j3a820:30492286 ```
deepak1556 commented 1 year ago

Unable to repro with latest stable 1.74

strich commented 1 year ago

This happened literally last night to me. I performed a shutdown with VSCode still running and it blocked the shutdown with an update process until the shutdown automatically aborted.

Version appears to be 1.73.1 as of today (Unsure if the version failed update last night of this was the latest as of yesterday). I've forced an update again and it is now 1.74.

deepak1556 commented 1 year ago

/cc @joaomoreno if you are aware of the inno updater blocking shutdown ? I am unable to repro the scenarios described in this issue.

joaomoreno commented 1 year ago

Very likely Inno Setup prevents shutting down while a Setup operation is in progress.

DC4JG commented 1 year ago

As of today and update to v1.80.0 it is still blocking Windows from shutdown. I always shutdown my Windows via win+x u u and this issue is happening on every single VSCode update for months.

rgary87 commented 1 year ago

Same thing here on VSC 1.80.0 and windows 11.

artyfarty commented 1 year ago

It happens to me for years.

ghost commented 7 months ago

I also experience this, windows + wsl.

My theory is that the WSL instance is terminate by windows as part of the shutdown, but the vscode instance either started the install or is waiting on something from the WSL instance. If the shutdown is interrupted the vscode window is usually responsive to UI input but stuck waiting for a response from WSL. In this state it never seems to be able to restart WSL like it normally would on starting vscode from a fresh start.

Currently there isn't any indication that an update is coming through, I find out later when my laptop didn't shutdown properly. It also can mean the user account remains logged in because shutdown is aborted and power is being drawn which is not good for security or battery charge.

Possible solution, disable vscode on close auto update when using WSL and instead give an alert making the user do it manually. Alternatively detect if an update has failed due to WSL shutdown and abort the on close auto update.

RyanCavanaugh commented 2 months ago

Useful for anyone investigating a fix: https://stackoverflow.com/questions/520910/how-to-simulate-windows-shutdown-for-debugging