-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Proposed fix that ensures parallel pip cache downloads can work #12364
Proposed fix that ensures parallel pip cache downloads can work #12364
Conversation
This seems like a reasonable approach. I can't confirm that the assumption you state is valid, but it seems correct to me. I think I'd be happy to say that we don't need to support URLs that serve different content at different times (although I don't have experience with some of the big development infrastructures that people work with, so it's possible I'm wrong). |
I am going to add references to the upstream issue, and document the invariant at least. |
Even if the writes assumption is wrong in some edge cases, this doesn't make things worse compared to 23.3 in those edge cases, and it makes things better everywhere else. |
For the write side, we assume that the server will only ever return the | ||
same data for the same URL, which ought to be the case for files pip is | ||
downloading. PyPI does not have a mechanism to swap out a wheel for | ||
another wheel, for example. If this assumption is not true, the |
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.
i vaguely recall this can happen on devpi for non-finalized wheels,
however its also highly unlikely
being race-safe on pypi goes a long way however
This PR also fixes the case where pip crashes half-way through writing the cache entry, i.e. after writing metadata but before writing the body. Assuming you're happy with the code, it seems like an immediate improvement, and a long-term fix can be done once CacheControl has fixes on its side for the two issues I filed. |
Thanks @itamarst! ^>^ |
Thank you so much for the prompt followup on your initial contribution, @itamarst! |
Fixes #12361
TODOs: