Skip to content

Commit 6fe75a3

Browse files
committed
(maint) Fix Connection Restart
Previously the connection stop method was stopping the language client and then killing the Language Server process, however this caused a timing issue as the client was trying to continually send a Shutdown event. This then caused a log storm of failed TCP events trying to send the Shutdown event to the non-existant Server process. This commit removes the Language Server process killing as the spawned Server Process, by default, will automatically close when the client disconnects.
1 parent 714743f commit 6fe75a3

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

client/src/connection.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ export class ConnectionManager implements IConnectionManager {
120120
public stop() {
121121
this.logger.debug('Stopping...')
122122

123-
if (this.connectionStatus === ConnectionStatus.Failed) {
124-
this.languageServerClient = undefined;
125-
this.languageServerProcess = undefined;
126-
}
127-
128123
this.connectionStatus = ConnectionStatus.Stopping;
129124

130125
// Close the language server client
@@ -133,14 +128,11 @@ export class ConnectionManager implements IConnectionManager {
133128
this.languageServerClient = undefined;
134129
}
135130

136-
// Kill the language server process we spawned
137-
if (this.languageServerProcess !== undefined) {
138-
// Terminate Language Server process
139-
// TODO: May not be functional on Windows.
140-
// Perhaps send the exit command and wait for process to exit?
141-
this.languageServerProcess.kill();
142-
this.languageServerProcess = undefined;
143-
}
131+
// The language server process we spawn will close once the
132+
// client disconnects. No need to forcibly kill the process here. Also the language
133+
// client will try and send a shutdown event, which will throw errors if the language
134+
// client can no longer transmit the message.
135+
this.languageServerProcess = undefined;
144136

145137
this.connectionStatus = ConnectionStatus.NotStarted;
146138

0 commit comments

Comments
 (0)