Skip to content
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

Failed to download: EPERM: operation not permitted #6602

Closed
strowk opened this issue Nov 21, 2020 · 12 comments · Fixed by #9585
Closed

Failed to download: EPERM: operation not permitted #6602

strowk opened this issue Nov 21, 2020 · 12 comments · Fixed by #9585
Labels
A-vscode vscode plugin issues Broken Window Bugs / technical debt to be addressed immediately good first issue S-actionable Someone could pick this issue up and work on it right now

Comments

@strowk
Copy link

strowk commented Nov 21, 2020

When I start VSCode it shows me a message that I need to install rust analyzer language server. I click download button and then following error is shown:

Failed to download: EPERM: operation not permitted, unlink 'c:\Users\myuser\AppData\Roaming\Code\User\globalStorage\matklad.rust-analyzer\rust-analyzer-windows.exe'

I'm using Windows 10, VSCode 1.51.1, extension Rust Analyzer v0.2.384

@lnicola
Copy link
Member

lnicola commented Nov 21, 2020

That can happen if the language server is running multiple times (if you have more than one Code open or if an older rust-analyzer instance got stuck and didn't close).

@lnicola lnicola added A-vscode vscode plugin issues S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Dec 21, 2020
@lnicola
Copy link
Member

lnicola commented Dec 21, 2020

Do you still have this issue?

@lnicola
Copy link
Member

lnicola commented Jan 17, 2021

Closing since there's not much to do here: we understand the cause (the server is already running), but there's nothing actionable.

@strowk please reopen if it stil happens with a single Code instance running or if you find other steps to reproduce it.

@lnicola lnicola closed this as completed Jan 17, 2021
@strowk
Copy link
Author

strowk commented Jan 17, 2021

I don't have that issue anymore (I stopped using rust-analyzer)

@Livven
Copy link

Livven commented Apr 7, 2021

@lnicola

[...], but there's nothing actionable.

What about keeping old rust-analyzer-windows.exe files around and downloading to a different path instead? Old versions could be cleaned up afterwards. This would enable analyzer updates even if an existing instance is running.

@lnicola
Copy link
Member

lnicola commented Apr 7, 2021

@Livven we could do that, but it's not trivial:

  • we need to keep generating new (probably random) filenames, since the user might have more than two open instances
  • on restart, we won't necessarily know which of the new versions is the good one, so we'll have to run each of them to check the version or try to download the server again
  • if the server crashes, we need to make sure to restart the same version, regardless of the name
    • there's even a slight window here where the user might start a new Code instance right after it crashed, so the server might not even exist any more
  • auto-updating is not the easiest functionality to test and I already broke it a couple of times :-)

A PR for this would probably be welcome, though.

@lnicola
Copy link
Member

lnicola commented Apr 7, 2021

I think there might be another open issue for this but I can't find it right now, let's reopen it since it's something that people seem to really care about.

@lnicola lnicola reopened this Apr 7, 2021
@lnicola lnicola added good first issue S-actionable Someone could pick this issue up and work on it right now and removed S-unactionable Issue requires feedback, design decisions or is blocked on other work labels Apr 7, 2021
@Livven
Copy link

Livven commented Apr 7, 2021

Thanks, I'll see if I can find the time and come up with something. I ran into a similar EPERM issue but with the offender being a rename. Don't remember the details, think it might be a slightly different problem but was too lazy to open a new issue.

@martin-t
Copy link

Has anybody tried renaming the old executable instead of deleting it and putting the new one in its place? I am told it's not possible to rename running executables but i remember doing exactly that in an updater for an app a wrote a long time ago.

@lnicola
Copy link
Member

lnicola commented Jun 14, 2021

What happens if running Code instance tries to restart the language server (because it crashes or the user requested it)?

If we add a version string to the server executable name we can avoid most of these issues.

@lnicola lnicola added the Broken Window Bugs / technical debt to be addressed immediately label Jul 12, 2021
@bors bors bot closed this as completed in f6896f8 Jul 13, 2021
@lnicola
Copy link
Member

lnicola commented Jul 13, 2021

Heads-up: #9585 just landed and should help with this, but not in every case: if you're running two Code instances, update the server from one of them, then restart or crash the server in the other one, it will use the new server version with the old extension, which can sometimes cause problems.

@lnicola
Copy link
Member

lnicola commented Jan 23, 2022

Update: since #11053, the server binary is bundled with the extension, and (assuming Code handles updates nicely), no longer updated while running. So this is finally fixed for good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues Broken Window Bugs / technical debt to be addressed immediately good first issue S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants