Dev/fix deadlock - #12
Merged
Merged
Conversation
On Windows, write_text_atomic's tmp.replace(dst) fails with PermissionError WinError 5 (access denied) or 32 (sharing violation) when antivirus, the search indexer, or OneDrive briefly holds the destination or temp file open without FILE_SHARE_DELETE. Under -j 8 the checkpoint is rewritten on every completed function, so such a collision eventually aborts the whole export (issue #11). Wrap the replace in a bounded retry that backs off and retries only on those transient winerror codes, then re-raises; other platforms and non-transient errors are unaffected (winerror is None off Windows). On final failure the temp file is removed so failures no longer leave .tmp orphans behind. tests/test_atomic_write.py reproduces the exact failure with a real Windows file lock (ctypes CreateFileW, read-share/no delete-share) and covers the transient-recovers, permanent-still-raises, and no-retry-off-Windows cases, plus a portable monkeypatched regression that runs on any platform. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removes the "Command: ..." status log emitted at the start of a standard export; the invocation is already discoverable and the line added noise. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two pre-existing Windows portability issues broke the local CI gate on Windows (both pass on the Linux CI, so they were latent): - parallel.py: os.sysconf is POSIX-only, so mypy on Windows flagged the attribute as undefined. Fetch it via getattr so the runtime guard is explicit and static analysis passes on every platform; behavior is unchanged (returns None when sysconf is unavailable). - _relativize_sources: os.path.relpath yields backslash separators on Windows, so exported source paths (and the corresponding test) diverged from the POSIX form. Normalize to forward slashes so exports match across platforms. ci-local.ps1 now reports all five checks passing on Windows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Windows reproduction helper used ctypes.windll / ctypes.WinError / wintypes, which are absent from the ctypes stubs on non-Windows platforms, so mypy failed on the Linux CI (it passed locally on Windows). Reach windll via getattr, use c_void_p for the HANDLE, and raise a plain OSError instead of WinError. Behavior on Windows is unchanged; verified with `mypy src tests --platform linux`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Fix deadlock, closes #11