vscode-remote-release
vscode-remote-release copied to clipboard
Some remote servers not shutting down

These are servers from several insiders builds going back to 9 days ago. They should shut down when there are no active EH connections for a few hours. Do you know if anything changed @alexdima?
Looking at the server log, most were started and never got a connection:

Just one of them did have connections and it looks like it tried to shut down:

And that's a strange place to stop

The only thing that I can think of is that this.dispose() throws which prevents execution from reaching process.exit(0).
The registered disposables are:
FileServiceDiskFileSystemProviderappInsightsAppender.flush()ErrorTelemetryPerhaps one of these decides to throw in theirdisposemethod. I've added server-side start-up telemetry, so it might be theappInsightsAppender.
But this doesn't explain the other servers not going down. I never 100% understood the auto-shutdown logic you added here, could you walk me through it?
It looks to me that perhaps _waitThenShutdown should be called from the initialize method as well? Otherwise a server without any connections will never shut down by itself, as you observe?
I can add a try/finally on that, although I would expect the exception to show up in the log...
So looking at the code, I'm wondering whether it actually broke recently or if this is a missing case. If you go through reconnection after a long time when the remote agent has shut down, then the ssh resolver will start an agent, and vscode will connect to it, and it decides that its EH is gone. So it never gets an EH. So either we need to start the timer right away or change the ssh resolver to not start a new agent during reconnection.
Yeah I guess it should be safe to start an agent that never gets a connection. If this isn't new then I don't know why I don't have 12 months of agents running. But I'm trying to see if it reproes in stable.
Stable has this same behavior, I'll fix it in Feb
Steps
- Connect to a Remote-SSH host
- Separately
ssh yourHostin a local terminal in another window, so you can run commands without a vscode server - In that terminal, run
ps ax | grep server-mainand verify that the vscode server from step 1 shows up - In a local vscode window, run "Kill VS Code Server on Host", pick the host that you connected to in step 1. This kills that server process
- Verify that window gets permanently disconnected
- In the ssh terminal, run the
pscommand again and verify that a server appears, it was started by the window trying to reconnect - Wait at least 5 minutes
- In the ssh terminal, run the
pscommand again and verify that the server has shut down, since it never got a successful connection