-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic downloading language server with multiple VS Code windows open causes failure #3090
Comments
It is scoped to the vscode installation. |
This might potentially be related to #3087. |
I am investigating this, unfortunately, no fruits, I just have a supposition that this has something to do with antivirus protection... |
I can't comment on #3087, but can you keep Process Monitor running when you run into this issue? It has options to log file system access and process creation. I assume the language server is running. Could it be a race condition? |
@Veetaha I can't check right now, are you downloading the binary to the final file? We could try to work around this by saving it to a temporary file, then renaming it with a number of retries just in case. But Procmon might still show something. |
@lnicola I think i've managed to reproduce this with the following: const fetch = require("node-fetch");
const path = require("path");
const fs = require("fs");
const { spawnSync } = require("child_process");
const file = path.resolve("ra_lsp_server.exe");
async function downloadFile(url, destFilePath) {
const response = await fetch(url);
return new Promise((resolve, reject) => response.body
.on("end", resolve)
.on("error", reject)
.pipe(fs.createWriteStream(destFilePath))
);
}
downloadFile(
"https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-02-10/ra_lsp_server-windows.exe",
file
).then(() => {
const res = spawnSync(file, ["--version"]);
console.dir(res);
if (res.error) {
console.error(res.error);
}
}) |
I have a supposition that write-stream is not closed when the promise is resolved ... |
Yes, I am 90% sure this is the problem! |
@Veetaha, I have Windows Defender as my anti virus if that helps. I think this may be caused by multiple VS Code instances automatically downloading and installing the same language server at the same time into the same location as @bjorn3 indicated that it was scoped to the vc code installation itself. I installed the extension on one of the open VS Code windows and all 3 running vs code windows then downloaded the language server at the same time. One of them "won" and thankfully I do not have a corrupted installation. |
@ninjasource , thank you for the bug report. It is very valuable for us. If you downloaded the binary only from one vscode window, other windows should not change the day and there are no problems with your binary after you reload vscode. We already found the cause of the bug, and applied the fix in #3092 |
Hi,
Great extension, thanks! I've just been through the install process (adding the extension - not building from source) and, unfortunately, I had multiple VS Code windows open at the same time. This caused the language server not to download properly on some of the VS Code windows. I don't know if the language server is scoped to the project or the entire VS Code installation. If the latter is the case then I guess there should be some sort of global mutex to protect the installation.
Windows 10, VS Code v1.42
David
The text was updated successfully, but these errors were encountered: