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

Fix --venv mode short link creation. #1505

Merged
merged 1 commit into from
Nov 1, 2021
Merged

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Nov 1, 2021

Previously this was non-atomic which would lead to artificial short link
creation collisions for venvs that consistently failed to populate.

Fixes #1504

Previously this was non-atomic which would lead to artificial short link
creation collisions for venvs that consistently failed to populate.

Fixes pex-tool#1504
raise RuntimeError(
"The venv for {pex} at {venv} has hash collisions with {count} other "
"{venvs}!\n{collisions}".format(
short_venv_dir = os.path.join(pex_info.pex_root, "venvs", "s", entropy)
Copy link
Member Author

@jsirois jsirois Nov 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub diff UI is pretty bad. The only change here is to use a nested atomic_directory with if short_venv.is_finalized; continue being the new collision detection mechanism that was previously performed by an eager os.symlink in a try / except. To effect this change, instead of the structure PEX_ROOT/venvs/short/<short hash> -> <real venv> the structure becomes PEX_ROOT/venvs/s/<short hash>/venv -> <real venv>. Notably, 'short/' is replaced with 's/venv/'; so we only gain 1 character for the short links.

@jsirois jsirois merged commit a566d48 into pex-tool:main Nov 1, 2021
@jsirois jsirois deleted the issues/1504 branch November 1, 2021 01:12
This was referenced Nov 1, 2021
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

Successfully merging this pull request may close these issues.

Persistent venvs/short collision
2 participants