-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Don't use lockfile to protect updates to selfcheck file. #6879
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
Conversation
1af49a6
to
92ec15d
Compare
(for folks following via email, I removed the incorrect paste in my previous comment) |
Just to make some differences explicit, so we can decide on their value:
|
Sure; would this be more suited to be explicitly hosted by PyPA? (also cc @techalchemy) |
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
It's not exactly a packaging-related tool so I'd prefer it live somewhere else. |
92ec15d
to
ea8da73
Compare
ea8da73
to
4728a8f
Compare
In #6970 there is an example of a likely race condition from concurrent cache access. This kind of usage will cause the move after write to fail, so I think we should retry a few times so as to not lose work we would've already done. The pipenv helper construction does not support this kind of usage as-is and IMO adding retry-related options to it may be irrelevant for most use cases. I would feel more comfortable proceeding with the current implementation for this and the HTTP cache use case and then factoring it out afterwards if it still looks substantial enough to be worth it. Definitely open to any thoughts on this approach. |
cab9c74
to
93fbb08
Compare
Rebased. This should be ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK with this in principle.
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
93fbb08
to
68e6feb
Compare
Anything else needed here in order to merge? |
One of us clicking merge. :) |
Previously, we were using
lockfile.LockFile
to protect updates to<cache dir>/selfcheck.json
.This uses hard links to create file locks, which are not supported in several contexts (as raised in various issues).
Now, we securely create a temporary file next to the target file, write to it, and rename it to the target path (removing the target path first if it exists).
In general we are graceful to failure, retrying several times over the course of 1 second before giving up. The only expected failure here should be on Windows if another process has an open file handle, and since this file is not very large it is reasonable that another pip instance will be done reading within that time period - otherwise we silently pass.
Closes #6954.