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

Add retry/backoff to file removing on Windows #578

Open
wolfv opened this issue Mar 22, 2024 · 2 comments
Open

Add retry/backoff to file removing on Windows #578

wolfv opened this issue Mar 22, 2024 · 2 comments

Comments

@wolfv
Copy link
Contributor

wolfv commented Mar 22, 2024

When overwriting a file on prefix updates it might try to overwrite a file that is still in use. The workaround is to stop all usages of the prefix before an update.

Where is this important

A common use-case is in a pixi project that is activated/used in an IDE. These IDE's might be using the Python Interpreter for the language server.

The error you'll get on a package update will then look like this:

❯ pixi add python>3.11
  ⠁ validate cache       [00:00:00] [━━━━━━━━━━━━━━━━━╾──] python (+1)
  ⠁ download & extract   [00:00:00] [────────────────────]      0 B @ 0 B/s    pydantic-core (+1)
  ⠁ installing packages  [00:00:00] [━╾──────────────────]     2/30 python (+14)
  × failed to unlink python-3.10.15-hfaddaf0_2_cpython.conda
  ╰─▶ failed to delete file: DLLs/_ctypes.pyd

Which is hard to read and UX unfriendly. A way to avoid this error entirely would be an amazing improvement for the UX.

Solution

This has been done before in mamba, by renaming it to a xxx.conda_trash. Then another run could look for all the trash files and actually remove them.

Initial issue:
Sometimes, removing a file that was (just) in use fails on Windows. I think it's good practice to add a retry after a few ms or more (we also hit something like that in pixi and fixed it with a sleep: prefix-dev/pixi@0ee497f

@adament
Copy link

adament commented Nov 13, 2024

If I were to take a stab at this, would you prefer to have a design discussion here first or that I just make an attempt at it and then we can have a discussion on the preferred solution in the pull request?

@baszalmstra
Copy link
Collaborator

Awesome! The issue already contains a possible solution, but if you have other ideas feel free to discuss it here or implement it right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants