Skip to content

release the MetaFile lock when a download fails mid-transfer - #921

Merged
ChristopherRabotin merged 2 commits into
nyx-space:masterfrom
ubeddulla:metafile-download-lock-cleanup
Nov 27, 2026
Merged

ChristopherRabotin merged 2 commits into
nyx-space:masterfrom
ubeddulla:metafile-download-lock-cleanup

Conversation

@ubeddulla

@ubeddulla ubeddulla commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MetaFile::process creates <file>.lock before it downloads a remote kernel, and every error branch removes it again except two: a failure while reading the response body (ureq's 30 s global timeout on a slow link, a connection reset, a truncated response, or the 200 MB limit) and a failure writing the bytes to the cache. Both return through ?, so the lock stays on disk. From then on every process(false) for that file waits 10 s and fails with PersistentLock until someone finds and deletes the lock by hand. false is the default for MetaFile.process, MetaAlmanac.load and Almanac.from_meta in Python, so one interrupted download of a large kernel is enough to break loading for good. #294 added autodelete for locks left by a killed process; this is the library leaving its own lock behind after an error it already handles.

Architectural Changes

No change

New Features

No change

Improvements

No change

Bug Fixes

Call the existing del_lock_file() before returning on the body read and cache write error paths, the same as the File::create, HTTP status and connection error branches already do. Successful downloads are unchanged.

Testing and validation

Added failed_download_releases_lock. It serves a response from a local listener whose body is shorter than its Content-Length, checks that process(false) returns an error, and checks that the lock file is gone. On master the lock is still there and the test fails. With the fix it passes. cargo fmt --all -- --check, cargo clippy -p anise -- -D warnings and cargo test --no-run --no-default-features pass locally. cargo test -p anise --lib shows the same failures with and without this change, all from tests that need the LFS kernels or network downloads.

Documentation

This PR does not primarily deal with documentation changes.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.18182% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.52%. Comparing base (85ebc97) to head (0f04b6e).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
anise/src/almanac/metaload/metafile.rs 93.18% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #921      +/-   ##
==========================================
+ Coverage   82.28%   82.52%   +0.23%     
==========================================
  Files         108      108              
  Lines       21433    21502      +69     
==========================================
+ Hits        17637    17745     +108     
+ Misses       3796     3757      -39     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ChristopherRabotin
ChristopherRabotin merged commit 6a26458 into nyx-space:master Nov 27, 2026
23 of 24 checks passed
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.

2 participants