Skip to content

Commit c7179db

Browse files
authored
fix(amazonq): Open multiple VSCode instances crashes Amazon Q Language Server (aws#6811)
## Problem When running multiple VSCode windows on mac arm64, Amazon Q's language server works correctly in the first window but crashes in additional windows with the error: `EXC_CRASH (SIGKILL (Code Signature Invalid))` ## Root Cause The crash occurs because: - The first VSCode window starts the language server and extracts everything (including the node binary from flare) - When additional VSCode windows are opened, they attempt to re-extract the zip from flare, overriding the current contents - On mac arm64, overwriting the node binary while it's in use by the first VSCode window can apparently cause code signing validation to fail for the next callers of it - This didn't effect windows when I was playing around with it yesterday - Weirdly enough, if you start the language server outside of VSCode, unzip servers.zip again, and then spawn a new language server it doesn't seem to have an issue. My guess is there's some weird interplay with electron owning the spawning of the processes ## Solution Instead of forcefully overriding contents in flare, only copy over the file if its necessary --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent cf83957 commit c7179db

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/core/src/shared/lsp/lspResolver.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,14 @@ export class LanguageServerResolver {
308308
// attempt to unzip
309309
const zipFile = new AdmZip(zip)
310310
const extractPath = zip.replace('.zip', '')
311-
zipFile.extractAllTo(extractPath, true)
311+
312+
/**
313+
* Avoid overwriting existing files during extraction to prevent file corruption.
314+
* On Mac ARM64 when a language server is already running in one VS Code window,
315+
* attempting to extract and overwrite its files from another window can cause
316+
* the newly started language server to crash with 'EXC_CRASH (SIGKILL (Code Signature Invalid))'.
317+
*/
318+
zipFile.extractAllTo(extractPath, false)
312319
} catch (e) {
313320
return false
314321
}

0 commit comments

Comments
 (0)