GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Evict corrupt cached Python archives by zaniebot · Pull Request #191 · astral-sh/uv-dev

Conversation

@zaniebot

@zaniebot zaniebot commented Jul 16, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

A downloaded Python archive is cached before its hash is verified, so a corrupt archive is reused on later runs. Remove it after a hash mismatch so the next run can download it again. This does not retry immediately or remove unrelated failed downloads. uv#19795 made cached Python downloads survive pruning, so corrupt entries can persist.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zaniebot zaniebot mentioned this pull request Jul 16, 2026
Evict corrupt cached Python archives zaniebot/uv#211
Closed
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from f565224 to b059d80 Compare September 1, 2026 21:00
@zaniebot zaniebot added priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect. bug Something isn't working risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. labels Sep 9, 2026
@astral-automations-bot astral-automations-bot Bot mentioned this pull request Oct 5, 2026
Rebase workflow fails when all pull request commits become empty #419
Open
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from b059d80 to 31475c2 Compare October 6, 2026 00:28
@codspeed

codspeed Bot commented Oct 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

  • discover_workspace_from_all_members_with_excludes
  • resolve_warm_jupyter
  • install_wheel_many_files
  • run_python_version_synthetic_workspace
  • resolve_warm_airflow
  • unpack_sdist_many_files
  • resolve_warm_jupyter_universal
  • discover_workspace_from_all_members

✅ 69 untouched benchmarks
⏩ 35 skipped benchmarks1


Comparing zb/bughunt200/119-corrupt-python-cache (aa4191d) with main (f1c34ca)

Open in CodSpeed

Footnotes

  1. 35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from 31475c2 to d5d2405 Compare October 8, 2026 03:54
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 8, 2026 03:55 Active
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 8, 2026 03:58 Active
astral-automations-bot[bot]
astral-automations-bot Bot reviewed Oct 8, 2026
View reviewed changes
Comment thread crates/uv-python-managed/src/downloads.rs Outdated
Comment on lines +623 to +624
if let Err(Error::HashMismatch { .. }) = &result {
match fs_err::tokio::remove_file(&target_cache_file).await {

@astral-automations-bot astral-automations-bot Bot Oct 8, 2026

Copy link
Copy Markdown

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.

[P2] Coordinate eviction with shared-cache writers

On Unix, installs with different installation directories can share UV_PYTHON_CACHE_DIR; the callers' installation-directory locks do not serialize them. Two readers can open the corrupt archive, one can remove it, and a subsequent attempt can publish a valid replacement before the slower reader reaches this removal. That reader then deletes the replacement, potentially causing the downloader's subsequent File::open to fail with NotFound. Use a cache-entry lock covering opening, publication, validation, and eviction so removal targets the archive that failed verification.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zaniebot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
astral-automations-bot[bot]
astral-automations-bot Bot reviewed Oct 8, 2026
View reviewed changes
Comment thread crates/uv-python-managed/src/downloads.rs Outdated
match fs_err::tokio::remove_file(&target_cache_file).await {
Ok(()) => {}
Err(err) if err.kind() == io::ErrorKind::NotFound => {}
Err(err) => return Err(err.into()),

@astral-automations-bot astral-automations-bot Bot Oct 8, 2026

Copy link
Copy Markdown

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.

[P2] Preserve the hash mismatch when eviction fails

If the cached archive is readable but cannot be deleted, such as in a read-only shared cache, this return replaces the confirmed HashMismatch with the cleanup I/O error. Callers consequently lose the integrity-failure diagnostic and its expected/computed hashes. Keep eviction best-effort and report its failure separately while returning the original mismatch, or retain both errors in a contextual error.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zaniebot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@zaniebot
zaniebot deployed to automations October 8, 2026 23:57 — with GitHub Actions Active
@zaniebot
zaniebot deployed to automations October 9, 2026 00:02 — with GitHub Actions Active
astral-automations-bot[bot]
astral-automations-bot Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread crates/uv-python-managed/src/downloads.rs
Comment on lines +1393 to +1395
let temp_dir = tempfile::tempdir().expect("temporary directory should be created");
let cache_dir = temp_dir.path().join("cache");
fs_err::create_dir_all(&cache_dir).expect("cache directory should be created");

@astral-automations-bot astral-automations-bot Bot Oct 9, 2026

Copy link
Copy Markdown

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.

[P3] Exercise a cache hit in the entry-lock test

This fixture creates the cache directory and lock, but never writes ababababa-python.zip. It therefore exercises a cache miss: a refactor that locks only downloads while leaving cached readers unlocked would still pass, despite breaking eviction coordination. Seed the matching cached archive before acquiring the lock so this test verifies that existing-archive reads wait too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zaniebot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
astral-automations-bot[bot]
astral-automations-bot Bot reviewed Oct 9, 2026
View reviewed changes
Comment thread crates/uv-python-managed/src/downloads.rs Outdated
Comment on lines +1317 to +1322
fs_err::write(
&cached_archive,
[
0x50, 0x4b, 0x03, 0x04, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x1e, 0x48, 0x5d,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00,
0x00, 0x00, 0x70, 0x79, 0x74, 0x68, 0x6f, 0x6e, 0x2f, 0x70, 0x79, 0x74, 0x68, 0x6f,

@astral-automations-bot astral-automations-bot Bot Oct 9, 2026

Copy link
Copy Markdown

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.

[P3] Make the archive fixture's contents explicit

These bytes encode a valid ZIP containing an empty python/python file. Successful extraction is essential here: malformed archive data would return ExtractError before reaching hash validation. The opaque byte array hides that requirement and makes fixture changes require understanding ZIP encoding. Prefer constructing named archive entries with the existing uv_test::archive::write_tar_gz helper in the python_install.rs integration module, and document why the expected digest deliberately differs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zaniebot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@zaniebot
zaniebot deployed to automations October 9, 2026 03:35 — with GitHub Actions Active
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from d0e207a to 68dfb81 Compare October 9, 2026 20:01
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 9, 2026 20:02 Active
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from 68dfb81 to 4dd00dc Compare October 14, 2026 18:37
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 14, 2026 18:38 Active
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 14, 2026 18:42 Active
astral-automations-bot[bot]
astral-automations-bot Bot reviewed Oct 14, 2026
View reviewed changes
Comment thread crates/uv/tests/python/python_install.rs
Comment on lines +4314 to +4318
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
fs_err::set_permissions(cache.path(), std::fs::Permissions::from_mode(0o555))?;
let (snapshot, _) = uv_test::run_and_format(

@astral-automations-bot astral-automations-bot Bot Oct 14, 2026

Copy link
Copy Markdown

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.

[P3] Separate the read-only cache scenario into a named test

This Unix-only block checks retention when lock acquisition fails, while the invocation below checks eviction after successful locking. These are independent regression scenarios: a failure here prevents the eviction assertion from running on Unix, and the read-only behavior cannot be selected independently. Following the repository’s test guidance, move this scenario into a separate #[cfg(unix)] test with explicit fixture setup, leaving the writable-cache eviction test cross-platform.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
zanieb and others added 4 commits October 16, 2026 18:05
@zanieb @astral-automations-bot
Evict corrupt cached Python archives
88ede23
@zaniebot @astral-automations-bot
Coordinate corrupt Python archive cache eviction
039d17b
@zaniebot @astral-automations-bot
Seed a cached archive in the entry lock regression
7e264ac
@zaniebot @astral-automations-bot
Build the cached archive integrity fixture from named files
aa4191d
@astral-automations-bot
astral-automations-bot Bot force-pushed the zb/bughunt200/119-corrupt-python-cache branch from 4dd00dc to aa4191d Compare October 16, 2026 18:12
@astral-automations-bot
astral-automations-bot Bot deployed to automations October 16, 2026 18:12 Active

This branch was successfully deployed

1 active deployment
automations — aa4191d2 Deployed Oct 16, 2026 by astral-automations-bot[bot] via review-code-quality / code quality review #10720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@astral-automations-bot astral-automations-bot[bot] astral-automations-bot[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. risk:3 Credible risk of meaningful incorrect behavior or regression; bounded or recoverable. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@zaniebot @zanieb
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.