microsoft / vscode

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

VS Code automatic update not working #225160

Closed felipecrs closed 3 weeks ago

felipecrs commented 2 months ago

Does this issue occur when all extensions are disabled?: Yes/No

Steps to Reproduce:

  1. On my machine, open an outdated VS Code, click on check updates
  2. Wait for it to ask to restart to complete the update
  3. Click on it, wait, then: explorer_m88sg2IF08 vscode-inno-updater-1723140822.log

I already tried several things, but the only thing that seems to work is to download the setup.exe again and run it by hand (which works flawlessly, no errors).

joaomoreno commented 2 months ago

Is there really such a C:\\Users\\felip\\AppData\\Local\\Programs\\Microsoft VS Code\\nul file in there?

felipecrs commented 2 months ago

Yes, there is. But if I delete it through Windows File Explorer, it comes back during the update itself and then the update errors again.

I tried deleting the file and clicking retry on the update a few times, but it doesn't seem to end.

felipecrs commented 2 months ago

Since there was an update a few moments ago, I was able to reproduce the issue again:

image

In fact, I can't delete the file through Windows Explorer.

felipecrs commented 2 months ago

Removing with PowerShell doesn't work either:

❯ Remove-Item "C:\Users\felip\AppData\Local\Programs\Microsoft VS Code\nul"
Remove-Item: Cannot find path 'C:\Users\felip\AppData\Local\Programs\Microsoft VS Code\nul' because it does not exist.

Removing with wsl works though:

wsl -e bash -c 'rm -f "$(wslpath "C:\Users\felip\AppData\Local\Programs\Microsoft VS Code\nul")"'

This indeed deletes the file and it no longer shows up in the Windows File Explorer.

Then, as I had mentioned, if I click retry on the updater window, it will spin a little and then fail again. The file will show up again on Windows File Explorer and the updater fails with the same error.

This means the file is being created by the updater itself.

I even tried deleting the file and waiting some minutes before clicking Retry to ensure the file won't be created again by some other process, but it doesn't. It only gets created after I click Retry on the updater.

felipecrs commented 2 months ago

I tried updating again today, and it worked, surprisingly. I don't think I did anything special beyond perhaps applying Windows Updates.

connor4312 commented 2 months ago

I hit this today in a slightly different version (https://github.com/microsoft/vscode/issues/225719) so it seems like it's still present

connor4312 commented 2 months ago

Upon killing the processes hold the lock and taking the update, the restored terminals show as disconnected, and I could not create new terminals until I restarted vscode:

image

Edit: so far 4 for 4 on hitting this each time I update Insiders

Tyriar commented 2 months ago

I haven't seen this, I tried restarting with vscode/xterm.js build tasks active and code - oss opened and it all shut down correctly.

I have no idea what the nul is about, but I looked at the closepsuedoconsole code in node-pty because of @connor4312's repro (https://github.com/microsoft/vscode/issues/225719) and it seems like it's all hooked up correctly:

https://github.com/microsoft/node-pty/blob/cb94da7f1aca551366fd7ffb27b1268d1b90679d/src/win/conpty.cc#L529-L535

@deepak1556 any hints on what could be going wrong here? I'm not sure how to investigate this further.

deepak1556 commented 1 month ago

https://github.com/microsoft/vscode/issues/225719 and this one are unrelated. I will dedupe them.

nul is special device name which can be treated similar to /dev/null this is used by utility process and node.js to provide the ignore option to stdio. We do launch the inno_updater using this stdio option of child process https://github.com/microsoft/vscode/blob/e37706186d2105b4158df80574323ebb987d7f64/src/vs/platform/update/electron-main/updateService.win32.ts#L226-L230 however those CreateFileW callsites should not create a file on disk, needs confirmation if it is the updater process. It is also a reserved name in Win32 namespace hence file manipulation cannot be performed from Win32 programs, refs https://github.com/PowerShell/PowerShell/issues/16841

@felipecrs can you perform the following steps,

1) Delete the nul file from a posix shell or command prompt 2) Start https://learn.microsoft.com/en-us/sysinternals/downloads/procmon to capture events 3) Perform update from VS Code 4) Save the events from proc monitor and send them to Deepak.Mohan@microsoft.com

felipecrs commented 1 month ago

@deepak1556, absolutely. Will remember to do that as soon as a new update of vscode arrives.

I already tried manually downgrading it then updating it, but the update happened very fast and the issue didn't happen. I guess it was cached somehow.

joaomoreno commented 3 weeks ago

@felipecrs Any updates here? 🙏

felipecrs commented 3 weeks ago

Yes, it hasn't happened anymore. :)