microsoft / vscode

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

serve-web needs to wait a certain amount of time after machine startup #233155

Open valleyriver717 opened 3 weeks ago

valleyriver717 commented 3 weeks ago

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

Steps to Reproduce:

  1. Boot windows machine.
  2. Run "code serve-web" on Powershell soon.
  3. Get below error.
PS C:\Users\Server> code --disable-extensions serve-web
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
thread 'main' panicked at library\std\src\time.rs:433:33:
overflow when subtracting duration from instant
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm not familiar with RUST, but the following code seems to be related.

https://github.com/microsoft/vscode/blob/76c27ee9ddaf998e5129418b5aba2af1d569cf50/cli/src/commands/serve_web.rs#L552

It seems to be querying for version recency every hour, but within the first hour after the machine is booted, the value is a negative. I have confirmed that it works fine when run after one hour from machine startup.

Ultimately, I would like to register this command as a service using nssm and have it accessed from machines in the same network using the nginx https proxy container. The principle is so simple that one wonders why other users do not encounter this problem.

I'm being meticulous, but this is my first time posting to github, so apologies if I'm being unkind.

valleyriver717 commented 1 week ago

I confirmed the one PC have this problem but another one do not. Both are windows 10 pro and the only difference I can think of is whether or not the docker runtime is running.

I wonder if it is affected by the type of CPU, GPU connection, or other hardware. Can you think of any workaround on the PC where the problem occurs?

rkjnsn commented 6 days ago

I also ran into this after a reboot today. The change cited by @valleyriver717 appears to have been introduced semi-recently in https://github.com/microsoft/vscode/commit/4d221c6b85608abf3df9e6c6ac91ffb3285dff78 by @connor4312.