Skip to content

Fix Windows tempdir cleanup race in test_vrt_tiled_scheduler_1714#1748

Merged
brendancol merged 1 commit into
mainfrom
fix-vrt-tiled-scheduler-windows-cleanup
May 12, 2026
Merged

Fix Windows tempdir cleanup race in test_vrt_tiled_scheduler_1714#1748
brendancol merged 1 commit into
mainfrom
fix-vrt-tiled-scheduler-windows-cleanup

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • test_vrt_tiled_scheduler_1714.py fails on Windows runners with PermissionError [WinError 32] because the threaded dask writer leaves file handles briefly open after the TemporaryDirectory context exits.
  • Pass ignore_cleanup_errors=True on each TemporaryDirectory so the recursive removal swallows the lingering handle and the directory is best-effort cleaned.
  • The assertions still run inside the context, so a real write failure would still fail the test. Only the post-test cleanup is now tolerant.

Test plan

  • pytest xrspatial/geotiff/tests/test_vrt_tiled_scheduler_1714.py -v passes locally on Linux.
  • CI confirms macOS + Windows runners stop failing on this file.

Threaded dask writes can leave file handles briefly open after the
context manager exits, so Windows raises PermissionError [WinError 32]
on the recursive directory removal. Linux closes the handles before
shutil.rmtree walks the tree, so it never fails there.

Pass ignore_cleanup_errors=True on each TemporaryDirectory. The tests
verify the writes succeeded before the context exits, so the cleanup
failure is purely a Windows-side temp-file leak, not a real bug.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 12, 2026
@brendancol brendancol merged commit 77e6e4e into main May 12, 2026
3 checks passed
brendancol added a commit that referenced this pull request May 12, 2026
The new test cases on this PR write a source TIFF inside a
TemporaryDirectory before invoking read_vrt. On Windows the read
path can leave a file handle open just past the context exit, so
shutil.rmtree raises WinError 32 (same shape as #1748). Linux closes
in time and never trips.

ignore_cleanup_errors=True keeps the cleanup best-effort. The
assertions still run inside the context so a real failure still
fails the test; only the tempdir teardown is now tolerant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant