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

Use filelock to lock the file cache #6471

Merged
merged 1 commit into from
Sep 17, 2022

Conversation

dimbleby
Copy link
Contributor

Fixes #6030, which I suspect is a significant contributor to "poetry hangs" complaints.

cachecontrol uses lockfile to create lock files. In the event that poetry exits while one of those files exists (eg because the impatient user goes Ctrl-C) the lockfile is not removed. That causes subsequent runs to block when trying to download the thing that it had been in the middle of dowloading.

FileLock from the filelock package does not have this undesirable property, when the process exits the lock is released and the next run can acquire it.

(filelock was already in the poetry dependency tree via virtualenv).

Note to anyone who tests this: filelock also doesn't remove the .lock file when it is done. So if you test this branch and then revert to a version of poetry using lockfile, you will experience the original issue. You'll want to do something like find ~/.cache/pypoetry -name '*.lock' -delete to get going again.

@dimbleby
Copy link
Contributor Author

Somewhat to my surprise, cachecontrol - which I had thought completely inactive - accepted my MR to switch their internal implementation from lockfile to filelock, and also released a version 0.12.12.

So this becomes redundant and simply updating cachecontrol should now be enough to fix #6030.

@dimbleby dimbleby closed this Sep 12, 2022
@dimbleby
Copy link
Contributor Author

cachecontrol 0.12.12 was yanked on the grounds that it was breaking, a 0.13 been promised but not yet delivered. It's hard to predict when - or whether - that will happen, so reopening this.

If and when cachecontrol 0.13 arrives this can be closed without merging, or reverted.

@dimbleby dimbleby reopened this Sep 15, 2022
@dimbleby dimbleby mentioned this pull request Sep 15, 2022
3 tasks
@neersighted neersighted added area/installer Related to the dependency installer kind/refactor Pulls that refactor, or clean-up code impact/changelog Requires a changelog entry labels Sep 15, 2022
src/poetry/utils/authenticator.py Outdated Show resolved Hide resolved
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/installer Related to the dependency installer impact/changelog Requires a changelog entry kind/refactor Pulls that refactor, or clean-up code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poetry hangs when installing libraries depending on pyparsing on M1 Apple Silicon
2 participants