vscode-coder icon indicating copy to clipboard operation
vscode-coder copied to clipboard

Race updating coder binary

Open aaronlehmann opened this issue 1 year ago • 3 comments

There appears to be a race in the Coder VSCode extension where using mulitple VS Code windows connected to different workspaces can try to update the coder binary at the same time, resulting in failures:

Error: ENOENT: no such file or directory, rename '/Users/mkrasnow/Library/Application Support/Code/User/globalStorage/coder.coder-remote/bin/coder-darwin-amd64' -> '/Users/mkrasnow/Library/Application Support/Code/User/globalStorage/coder.coder-remote/bin/coder-darwin-amd64.old-rtvak' 
Error: ENOENT: no such file or directory, rename '/Users/mkrasnow/Library/Application Support/Code/User/globalStorage/coder.coder-remote/bin/coder-darwin-amd64' -> '/Users/mkrasnow/Library/Application Support/Code/User/globalStorage/coder.coder-remote/bin/coder-darwin-amd64.old-5oo5n'

aaronlehmann avatar Aug 29 '24 00:08 aaronlehmann

I've only seen this happen in VS Code, but it may also be an issue with the JetBrains Gateway plugin, so it would be worth checking there as well.

aaronlehmann avatar Aug 29 '24 00:08 aaronlehmann

Given that we can have multiple deployments with different versions, it would make sense to store the Coder binary in a separate directory or file prefix per deployment.

There is a separate issue where the initial "rename" of the existing binary is racy. My experience with implementing coder update in the previous version of Coder Enterprise is that this step is only necessary on Windows, and that on Darwin/Linux platforms we can just write the updated binary to a new file, and then move, overwriting the running binary.

johnstcn avatar May 21 '25 13:05 johnstcn

Seems to be a duplicate for https://github.com/coder/vscode-coder/issues/575 or at the very least closely related.

I think now we always place binaries in their deployment folder (uses the URL as a folder name) so this only happens when connecting to the same deployment in multiple windows.

EhabY avatar Nov 10 '25 15:11 EhabY

Fixed by https://github.com/coder/vscode-coder/pull/656

EhabY avatar Nov 25 '25 10:11 EhabY