fix: delete zero-byte cache files on load instead of leaving stale locks#23
Closed
jburos wants to merge 1 commit into
Closed
fix: delete zero-byte cache files on load instead of leaving stale locks#23jburos wants to merge 1 commit into
jburos wants to merge 1 commit into
Conversation
When a computation is interrupted mid-write, the cache file is left as a zero-byte placeholder (:started status). Previously this just warned and left the file in place, which caused subsequent recomputation attempts to fail (e.g. AssertionError on __status__ checks or other errors) because the zero-byte file continued to be detected as :started on every retry. This change deletes the zero-byte file before touch()-ing a fresh one, so the recomputation proceeds exactly as it would for a fresh (:unstarted) cache miss. Complements 5185bd5 ("retry after deserialization failure") which handles corrupted non-empty files. Together they cover both failure modes: - Non-empty file that fails to deserialize → caught, deleted, retried (5185bd5) - Zero-byte file left by interrupted write → deleted, retried (this PR) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
|
Hm, I had at some point added the more more verbose warnings and the error to figure out what exactly was going on. The issue was that in the dependency graph, it makes sense to cache expensive leaves - but if they are accessed via multiple paths, these paths don't synchronize. The way this is fixed now is by having a global per type+property locked dict of path=>locks which enforces synchronization - no more deserialization failures now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When a computation is interrupted mid-write (process kill, OOM, crash), the cache file is left as a zero-byte placeholder.
get_cache_statusreturns:startedfor these files.The current handling warns but leaves the file in place, which means subsequent recomputation attempts also fail — the zero-byte file acts as a permanent lock requiring manual deletion.
Relation to 5185bd5
Commit 5185bd5 ("retry after deserialization failure") handles corrupted non-empty files that fail to deserialize. This PR handles the complementary case: zero-byte files left by interrupted writes.
:startedstatus)Together they cover both failure modes cleanly.
Change
🤖 Generated with Claude Code