From 3999ae3728a63a0990820e6fd3d48703c31a0fbe Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Thu, 28 Sep 2023 14:25:35 -0700 Subject: [PATCH 1/2] Avoid double restarts of the query server Previously, if there was an explicit restart of the query server (eg- by changing a configuration setting), then the query server process would be started twice: once by the `close` handler and once by the restart command. By adding the `removeAllListeners` to the dispose method, we ensure that when the query server shuts down gracefully, there won't be a `close` listener that is going to restart it a second time if there is a different way of restarting it. --- extensions/ql-vscode/src/query-server/server-process.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/ql-vscode/src/query-server/server-process.ts b/extensions/ql-vscode/src/query-server/server-process.ts index dc3f76f7ee0..44423c648e7 100644 --- a/extensions/ql-vscode/src/query-server/server-process.ts +++ b/extensions/ql-vscode/src/query-server/server-process.ts @@ -26,6 +26,7 @@ export class ServerProcess implements Disposable { this.connection.end(); this.child.stdin!.end(); this.child.stderr!.destroy(); + this.child.removeAllListeners(); // TODO kill the process if it doesn't terminate after a certain time limit. // On Windows, we usually have to terminate the process before closing its stdout. From 2b17979b6c1c101e9cc80461a6a9ff62fa634ea2 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Thu, 28 Sep 2023 14:29:40 -0700 Subject: [PATCH 2/2] Update changelog --- extensions/ql-vscode/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/ql-vscode/CHANGELOG.md b/extensions/ql-vscode/CHANGELOG.md index 2fd6c12181c..fd8a3ce17cc 100644 --- a/extensions/ql-vscode/CHANGELOG.md +++ b/extensions/ql-vscode/CHANGELOG.md @@ -2,6 +2,8 @@ ## [UNRELEASED] +- Fix a bug where the query server was restarted twice after configuration changes. [#2884](https://github.com/github/vscode-codeql/pull/2884). + ## 1.9.0 - 19 September 2023 - Release the [CodeQL model editor](https://codeql.github.com/docs/codeql/codeql-for-visual-studio-code/using-the-codeql-model-editor) to create CodeQL model packs for Java frameworks. Open the editor using the "CodeQL: Open CodeQL Model Editor (Beta)" command. [#2823](https://github.com/github/vscode-codeql/pull/2823)