Skip to content

Commit

Permalink
Fix venv re-population race. (pantsbuild#16931)
Browse files Browse the repository at this point in the history
There was a race in venv re-population due to a non-atomic `rm`, create
sequence. There was no real need for the `rm` and the create is atomic 
on its own; so just remove the `rm` which was only attempting to guard
"corrupted" venvs in a slapdash way. Now the venv either exists or it
doesn't from the script point of view. If the venv exists but has been
tampered with, its execution will consistently fail until there is a
manual intervention removing the venv dir offline.

Fixes pantsbuild#14618
Fixes pantsbuild#16778
  • Loading branch information
jsirois authored Sep 20, 2022
1 parent 95850c9 commit cace851
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/python/pants/backend/python/util_rules/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,7 @@ def _create_venv_script(
# If the seeded venv has been removed from the PEX_ROOT, we re-seed from the original
# `--venv` mode PEX file.
if [ ! -e "${{target_venv_executable}}" ]; then
rm -rf "${{venv_dir}}" || true
if [ ! -e "${{venv_dir}}" ]; then
PEX_INTERPRETER=1 ${{execute_pex_args}} -c ''
fi
Expand Down

0 comments on commit cace851

Please sign in to comment.