Commits
Click on a commit to change the comparison rangeFix race condition in filesystem lease storage with atomic writes
The race condition occurred because file writes were not atomic:
- When writing lease files or the expiration index, readers could see
partial/corrupted JSON data
- The read_lease method would then delete the 'corrupted' file,
destroying valid data
This fix:
1. Adds _atomic_write_json() helper that uses write-to-temp-then-rename
pattern to ensure readers never see partial content
2. Updates _save_expiration_index() to use atomic writes
3. Updates create_lease() to use atomic writes for lease files
4. Updates renew_lease() to use atomic writes
5. Removes destructive error handling in read_lease() - no longer
deletes files on JSON decode errors since with atomic writes this
should be rare and could be a transient issue
Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>1 day ago
by devin-ai-integration[bot] Restore cleanup behavior in read_lease (safe with atomic writes)
With atomic writes in place, readers will never see partial/corrupted
data from concurrent writes. So if a file IS corrupted, it's a real
corruption issue that should be cleaned up, not a race condition.
This restores the original cleanup behavior that the test expects.
Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>1 day ago
by devin-ai-integration[bot] Remove polling timeout logic from test file
As requested in PR review - pytest-timeout already handles preventing
tests from running indefinitely, so the custom polling timeout logic
is unnecessary.
Co-Authored-By: alex.s@prefect.io <ajstreed1@gmail.com>24 hours ago
by devin-ai-integration[bot]